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 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
@@ -7,12 +7,12 @@ interface AbbotConfig {
7
7
  headers: {
8
8
  accept: string;
9
9
  lang: string;
10
- "app-version": string;
11
10
  post: {
12
11
  contentType: string;
13
12
  };
14
13
  };
15
14
  timeout: number;
15
+ customHeaders: Record<string, string>;
16
16
  };
17
17
  app: {
18
18
  redirectUrl: string;
package/dist/index.d.ts CHANGED
@@ -7,12 +7,12 @@ interface AbbotConfig {
7
7
  headers: {
8
8
  accept: string;
9
9
  lang: string;
10
- "app-version": string;
11
10
  post: {
12
11
  contentType: string;
13
12
  };
14
13
  };
15
14
  timeout: number;
15
+ customHeaders: Record<string, string>;
16
16
  };
17
17
  app: {
18
18
  redirectUrl: string;
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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abbot-http-client",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "This package helps Abbot team to handle all the axios requests.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",