abbot-http-client 0.0.62 → 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 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,8 @@ var defaultConfig = {
|
|
|
59
59
|
post: {
|
|
60
60
|
contentType: "application/x-www-form-urlencoded"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
},
|
|
63
|
+
customHeaders: {}
|
|
63
64
|
},
|
|
64
65
|
app: {
|
|
65
66
|
redirectUrl: "/login",
|
|
@@ -367,6 +368,12 @@ var AbbotHttp = class extends AxiosBase {
|
|
|
367
368
|
if (this.config.app.userJwt) {
|
|
368
369
|
req.headers.setAuthorization(`Bearer ${this.config.app.userJwt}`);
|
|
369
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
|
+
}
|
|
370
377
|
return req;
|
|
371
378
|
},
|
|
372
379
|
(error) => Promise.reject(error)
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -12,7 +12,8 @@ var defaultConfig = {
|
|
|
12
12
|
post: {
|
|
13
13
|
contentType: "application/x-www-form-urlencoded"
|
|
14
14
|
}
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
customHeaders: {}
|
|
16
17
|
},
|
|
17
18
|
app: {
|
|
18
19
|
redirectUrl: "/login",
|
|
@@ -320,6 +321,12 @@ var AbbotHttp = class extends AxiosBase {
|
|
|
320
321
|
if (this.config.app.userJwt) {
|
|
321
322
|
req.headers.setAuthorization(`Bearer ${this.config.app.userJwt}`);
|
|
322
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
|
+
}
|
|
323
330
|
return req;
|
|
324
331
|
},
|
|
325
332
|
(error) => Promise.reject(error)
|