@mepkg/maxios 1.0.0 → 1.1.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.
package/package.json CHANGED
@@ -14,10 +14,10 @@
14
14
  "test:watch": "node --test --watch 'tests/**/*.test.js'"
15
15
  },
16
16
  "dependencies": {
17
- "axios": "1.16.0",
17
+ "axios": "1.16.1",
18
18
  "hpagent": "^1.2.0",
19
19
  "lodash-es": "^4.18.1",
20
20
  "melperjs": "^15.0.0"
21
21
  },
22
- "version": "1.0.0"
22
+ "version": "1.1.0"
23
23
  }
package/src/maxios.js CHANGED
@@ -8,18 +8,17 @@ export class Maxios {
8
8
  constructor(proxy = null, config = {}, cookies = {}) {
9
9
  this.proxy = proxy;
10
10
  this.cookies = cookies;
11
- config = config || {};
11
+ this.config = config || {};
12
+
13
+ this.config.responseType = "text";
14
+ this.config.timeout = config.timeout || 10000;
12
15
 
13
- const axiosOptions = {
14
- responseType: 'text',
15
- timeout: config.timeout ?? 10000
16
- };
17
16
  if (this.proxy) {
18
- const proxyTimeout = axiosOptions.timeout * 0.75 || undefined;
19
- axiosOptions.httpsAgent = new HttpsProxyAgent({proxy, timeout: proxyTimeout});
20
- axiosOptions.httpAgent = new HttpProxyAgent({proxy, timeout: proxyTimeout});
17
+ const proxyTimeout = this.config.timeout * 0.75 || undefined;
18
+ this.config.httpsAgent = new HttpsProxyAgent({proxy, timeout: proxyTimeout});
19
+ this.config.httpAgent = new HttpProxyAgent({proxy, timeout: proxyTimeout});
21
20
  }
22
- this.client = axios.create(axiosOptions);
21
+ this.client = axios.create(this.config);
23
22
 
24
23
  this.client.interceptors.request.use((request) => {
25
24
  this.#requestCookies(request);
package/src/tls-client.js CHANGED
@@ -78,7 +78,7 @@ export class TlsClient {
78
78
  "proxy": proxy || this.proxy || undefined,
79
79
  "impersonate": impersonate || this.config.impersonate,
80
80
  "visit": visit || this.config.visit,
81
- "redirects": maxRedirects,
81
+ "maxRedirects": maxRedirects,
82
82
  "base64": base64 ?? this.config.base64,
83
83
  "key": this.tlsServer.key
84
84
  };