abbot-http-client 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -56,11 +56,11 @@ var defaultConfig = {
|
|
|
56
56
|
headers: {
|
|
57
57
|
accept: "*/*",
|
|
58
58
|
lang: "TH",
|
|
59
|
-
"app-version": "",
|
|
60
59
|
post: {
|
|
61
60
|
contentType: "application/x-www-form-urlencoded"
|
|
62
61
|
}
|
|
63
|
-
}
|
|
62
|
+
},
|
|
63
|
+
customHeaders: {}
|
|
64
64
|
},
|
|
65
65
|
app: {
|
|
66
66
|
redirectUrl: "/login",
|
|
@@ -368,6 +368,12 @@ var AbbotHttp = class extends AxiosBase {
|
|
|
368
368
|
if (this.config.app.userJwt) {
|
|
369
369
|
req.headers.setAuthorization(`Bearer ${this.config.app.userJwt}`);
|
|
370
370
|
}
|
|
371
|
+
const customHeaders = Object.keys(this.config.axios.customHeaders);
|
|
372
|
+
if (customHeaders.length > 0) {
|
|
373
|
+
for (const key of customHeaders) {
|
|
374
|
+
req.headers.set(key, this.config.axios.customHeaders[key] || "");
|
|
375
|
+
}
|
|
376
|
+
}
|
|
371
377
|
return req;
|
|
372
378
|
},
|
|
373
379
|
(error) => Promise.reject(error)
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -9,11 +9,11 @@ var defaultConfig = {
|
|
|
9
9
|
headers: {
|
|
10
10
|
accept: "*/*",
|
|
11
11
|
lang: "TH",
|
|
12
|
-
"app-version": "",
|
|
13
12
|
post: {
|
|
14
13
|
contentType: "application/x-www-form-urlencoded"
|
|
15
14
|
}
|
|
16
|
-
}
|
|
15
|
+
},
|
|
16
|
+
customHeaders: {}
|
|
17
17
|
},
|
|
18
18
|
app: {
|
|
19
19
|
redirectUrl: "/login",
|
|
@@ -321,6 +321,12 @@ var AbbotHttp = class extends AxiosBase {
|
|
|
321
321
|
if (this.config.app.userJwt) {
|
|
322
322
|
req.headers.setAuthorization(`Bearer ${this.config.app.userJwt}`);
|
|
323
323
|
}
|
|
324
|
+
const customHeaders = Object.keys(this.config.axios.customHeaders);
|
|
325
|
+
if (customHeaders.length > 0) {
|
|
326
|
+
for (const key of customHeaders) {
|
|
327
|
+
req.headers.set(key, this.config.axios.customHeaders[key] || "");
|
|
328
|
+
}
|
|
329
|
+
}
|
|
324
330
|
return req;
|
|
325
331
|
},
|
|
326
332
|
(error) => Promise.reject(error)
|