axios 1.3.4 → 1.3.6

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.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

package/index.d.cts CHANGED
@@ -370,7 +370,7 @@ declare namespace axios {
370
370
  transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
371
371
  headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
372
372
  params?: any;
373
- paramsSerializer?: ParamsSerializerOptions;
373
+ paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
374
374
  data?: D;
375
375
  timeout?: Milliseconds;
376
376
  timeoutErrorMessage?: string;
@@ -390,6 +390,7 @@ declare namespace axios {
390
390
  maxRate?: number | [MaxUploadRate, MaxDownloadRate];
391
391
  beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>}) => void;
392
392
  socketPath?: string | null;
393
+ transport?: any;
393
394
  httpAgent?: any;
394
395
  httpsAgent?: any;
395
396
  proxy?: AxiosProxyConfig | false;
package/index.d.ts CHANGED
@@ -311,7 +311,7 @@ export interface AxiosRequestConfig<D = any> {
311
311
  transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
312
312
  headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
313
313
  params?: any;
314
- paramsSerializer?: ParamsSerializerOptions;
314
+ paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
315
315
  data?: D;
316
316
  timeout?: Milliseconds;
317
317
  timeoutErrorMessage?: string;
@@ -331,6 +331,7 @@ export interface AxiosRequestConfig<D = any> {
331
331
  maxRate?: number | [MaxUploadRate, MaxDownloadRate];
332
332
  beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>}) => void;
333
333
  socketPath?: string | null;
334
+ transport?: any;
334
335
  httpAgent?: any;
335
336
  httpsAgent?: any;
336
337
  proxy?: AxiosProxyConfig | false;
package/lib/core/Axios.js CHANGED
@@ -57,11 +57,17 @@ class Axios {
57
57
  }, false);
58
58
  }
59
59
 
60
- if (paramsSerializer !== undefined) {
61
- validator.assertOptions(paramsSerializer, {
62
- encode: validators.function,
63
- serialize: validators.function
64
- }, true);
60
+ if (paramsSerializer != null) {
61
+ if (utils.isFunction(paramsSerializer)) {
62
+ config.paramsSerializer = {
63
+ serialize: paramsSerializer
64
+ }
65
+ } else {
66
+ validator.assertOptions(paramsSerializer, {
67
+ encode: validators.function,
68
+ serialize: validators.function
69
+ }, true);
70
+ }
65
71
  }
66
72
 
67
73
  // Set config.method
@@ -29,9 +29,7 @@ function parseTokens(str) {
29
29
  return tokens;
30
30
  }
31
31
 
32
- function isValidHeaderName(str) {
33
- return /^[-_a-zA-Z]+$/.test(str.trim());
34
- }
32
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
35
33
 
36
34
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
37
35
  if (utils.isFunction(filter)) {
package/lib/env/data.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.3.4";
1
+ export const VERSION = "1.3.6";
package/lib/utils.js CHANGED
@@ -188,12 +188,16 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
188
188
  * @returns {boolean} True if value is an FormData, otherwise false
189
189
  */
190
190
  const isFormData = (thing) => {
191
- const pattern = '[object FormData]';
191
+ let kind;
192
192
  return thing && (
193
- (typeof FormData === 'function' && thing instanceof FormData) ||
194
- toString.call(thing) === pattern ||
195
- (isFunction(thing.toString) && thing.toString() === pattern)
196
- );
193
+ (typeof FormData === 'function' && thing instanceof FormData) || (
194
+ isFunction(thing.append) && (
195
+ (kind = kindOf(thing)) === 'formdata' ||
196
+ // detect form-data instance
197
+ (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
198
+ )
199
+ )
200
+ )
197
201
  }
198
202
 
199
203
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -25,7 +25,7 @@
25
25
  "scripts": {
26
26
  "test": "npm run test:eslint && npm run test:mocha && npm run test:karma && npm run test:dtslint && npm run test:exports",
27
27
  "test:eslint": "node bin/ssl_hotfix.js eslint lib/**/*.js",
28
- "test:dtslint": "node bin/ssl_hotfix.js dtslint",
28
+ "test:dtslint": "dtslint --localTs node_modules/typescript/lib",
29
29
  "test:mocha": "node bin/ssl_hotfix.js mocha test/unit/**/*.js --timeout 30000 --exit",
30
30
  "test:exports": "node bin/ssl_hotfix.js mocha test/module/test.js --timeout 30000 --exit",
31
31
  "test:karma": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: karma start karma.conf.cjs --single-run",