@trayio/axios 4.79.0 → 4.80.0

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.
@@ -5,6 +5,7 @@ import FormData = require('form-data');
5
5
  import { FileStorage } from '@trayio/commons/file/File';
6
6
  type AxiosOptions = {
7
7
  rejectUnauthorized: boolean;
8
+ followRedirects: boolean;
8
9
  };
9
10
  export declare class AxiosHttpClient implements HttpClient {
10
11
  private readonly fileStorage;
@@ -1 +1 @@
1
- {"version":3,"file":"AxiosHttpClient.d.ts","sourceRoot":"","sources":["../../src/http/AxiosHttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAEN,UAAU,EACV,WAAW,EAEX,YAAY,EAEZ,MAAM,2BAA2B,CAAC;AAInC,OAAO,QAAQ,GAAG,QAAQ,WAAW,CAAC,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAMxD,KAAK,YAAY,GAAG;IACnB,kBAAkB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,qBAAa,eAAgB,YAAW,UAAU;IAEhD,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,WAAW,GAAE,WAAqC,EAClD,YAAY,GAAE,YAA4C;IAG5E,OAAO,CACN,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,GAClB,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,YAAY,CAAC;IAsHrC,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,2BAA2B;IAUnC,YAAY,aAAc,QAAQ,cAAc,OAAO,MAAM,EAAE,MAAM,CAAC,cAKpE;CACF"}
1
+ {"version":3,"file":"AxiosHttpClient.d.ts","sourceRoot":"","sources":["../../src/http/AxiosHttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAEN,UAAU,EACV,WAAW,EAEX,YAAY,EAEZ,MAAM,2BAA2B,CAAC;AAInC,OAAO,QAAQ,GAAG,QAAQ,WAAW,CAAC,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAMxD,KAAK,YAAY,GAAG;IACnB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,qBAAa,eAAgB,YAAW,UAAU;IAEhD,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,WAAW,GAAE,WAAqC,EAClD,YAAY,GAAE,YAG9B;IAGF,OAAO,CACN,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,GAClB,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,YAAY,CAAC;IAuHrC,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,2BAA2B;IAUnC,YAAY,aAAc,QAAQ,cAAc,OAAO,MAAM,EAAE,MAAM,CAAC,cAKpE;CACF"}
@@ -39,7 +39,10 @@ const function_1 = require("fp-ts/lib/function");
39
39
  class AxiosHttpClient {
40
40
  fileStorage;
41
41
  axiosOptions;
42
- constructor(fileStorage = new NodeFsFileStorage_1.NodeFsFileStorage(), axiosOptions = { rejectUnauthorized: false }) {
42
+ constructor(fileStorage = new NodeFsFileStorage_1.NodeFsFileStorage(), axiosOptions = {
43
+ rejectUnauthorized: false,
44
+ followRedirects: true,
45
+ }) {
43
46
  this.fileStorage = fileStorage;
44
47
  this.axiosOptions = axiosOptions;
45
48
  }
@@ -110,6 +113,7 @@ class AxiosHttpClient {
110
113
  headers,
111
114
  httpsAgent: axiosHttpsAgent,
112
115
  params: request.queryString,
116
+ ...(this.axiosOptions.followRedirects ? {} : { maxRedirects: 0 }),
113
117
  };
114
118
  return (0, Task_1.createTaskEitherFromPromiseWithSimpleError)(() => (0, axios_1.default)(axiosConfig)
115
119
  .then(this.axiosResponseToHttpResponse)
@@ -4,5 +4,8 @@ const HttpClient_abstract_test_1 = require("@trayio/commons/http/HttpClient.abst
4
4
  const NodeFsFileStorage_1 = require("@trayio/commons/file/NodeFsFileStorage");
5
5
  const AxiosHttpClient_1 = require("./AxiosHttpClient");
6
6
  describe('AxiosHttpClient Tests', () => {
7
- (0, HttpClient_abstract_test_1.httpClientTest)(new AxiosHttpClient_1.AxiosHttpClient(new NodeFsFileStorage_1.NodeFsFileStorage(), { rejectUnauthorized: false }));
7
+ (0, HttpClient_abstract_test_1.httpClientTest)(new AxiosHttpClient_1.AxiosHttpClient(new NodeFsFileStorage_1.NodeFsFileStorage(), {
8
+ rejectUnauthorized: false,
9
+ followRedirects: true,
10
+ }));
8
11
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/axios",
3
- "version": "4.79.0",
3
+ "version": "4.80.0",
4
4
  "description": "Axios extensions and implementations",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"
@@ -14,7 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@trayio/commons": "4.79.0",
17
+ "@trayio/commons": "4.80.0",
18
18
  "axios": "1.8.3",
19
19
  "form-data": "4.0.0"
20
20
  },