axios 1.13.1 → 1.13.3

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/index.d.cts CHANGED
@@ -100,7 +100,7 @@ declare class AxiosError<T = unknown, D = any> extends Error {
100
100
  isAxiosError: boolean;
101
101
  status?: number;
102
102
  toJSON: () => object;
103
- cause?: unknown;
103
+ cause?: Error;
104
104
  event?: BrowserProgressEvent;
105
105
  static from<T = unknown, D = any>(
106
106
  error: Error | unknown,
@@ -515,14 +515,32 @@ declare namespace axios {
515
515
  runWhen?: (config: InternalAxiosRequestConfig) => boolean;
516
516
  }
517
517
 
518
- type AxiosRequestInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions) => number;
518
+ type AxiosInterceptorFulfilled<T> = (value: T) => T | Promise<T>;
519
+ type AxiosInterceptorRejected = (error: any) => any;
519
520
 
520
- type AxiosResponseInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null) => number;
521
+ type AxiosRequestInterceptorUse<T> = (
522
+ onFulfilled?: AxiosInterceptorFulfilled<T> | null,
523
+ onRejected?: AxiosInterceptorRejected | null,
524
+ options?: AxiosInterceptorOptions
525
+ ) => number;
526
+
527
+ type AxiosResponseInterceptorUse<T> = (
528
+ onFulfilled?: AxiosInterceptorFulfilled<T> | null,
529
+ onRejected?: AxiosInterceptorRejected | null
530
+ ) => number;
531
+
532
+ interface AxiosInterceptorHandler<T> {
533
+ fulfilled: AxiosInterceptorFulfilled<T>;
534
+ rejected?: AxiosInterceptorRejected;
535
+ synchronous: boolean;
536
+ runWhen?: (config: AxiosRequestConfig) => boolean;
537
+ }
521
538
 
522
539
  interface AxiosInterceptorManager<V> {
523
540
  use: V extends AxiosResponse ? AxiosResponseInterceptorUse<V> : AxiosRequestInterceptorUse<V>;
524
541
  eject(id: number): void;
525
542
  clear(): void;
543
+ handlers?: Array<AxiosInterceptorHandler<V>>;
526
544
  }
527
545
 
528
546
  interface AxiosInstance extends Axios {
package/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  // TypeScript Version: 4.7
2
+ type StringLiteralsOrString<Literals extends string> = Literals | (string & {});
3
+
2
4
  export type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
3
5
 
4
6
  interface RawAxiosHeaders {
@@ -302,7 +304,7 @@ export interface AxiosProgressEvent {
302
304
 
303
305
  type Milliseconds = number;
304
306
 
305
- type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | (string & {});
307
+ type AxiosAdapterName = StringLiteralsOrString<'xhr' | 'http' | 'fetch'>;
306
308
 
307
309
  type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
308
310
 
@@ -317,7 +319,7 @@ export type LookupAddress = string | LookupAddressEntry;
317
319
 
318
320
  export interface AxiosRequestConfig<D = any> {
319
321
  url?: string;
320
- method?: Method | string;
322
+ method?: StringLiteralsOrString<Method>;
321
323
  baseURL?: string;
322
324
  allowAbsoluteUrls?: boolean;
323
325
  transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
@@ -332,7 +334,7 @@ export interface AxiosRequestConfig<D = any> {
332
334
  adapter?: AxiosAdapterConfig | AxiosAdapterConfig[];
333
335
  auth?: AxiosBasicCredentials;
334
336
  responseType?: ResponseType;
335
- responseEncoding?: responseEncoding | string;
337
+ responseEncoding?: StringLiteralsOrString<responseEncoding>;
336
338
  xsrfCookieName?: string;
337
339
  xsrfHeaderName?: string;
338
340
  onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
@@ -348,7 +350,7 @@ export interface AxiosRequestConfig<D = any> {
348
350
  httpAgent?: any;
349
351
  httpsAgent?: any;
350
352
  proxy?: AxiosProxyConfig | false;
351
- cancelToken?: CancelToken;
353
+ cancelToken?: CancelToken | undefined;
352
354
  decompress?: boolean;
353
355
  transitional?: TransitionalOptions;
354
356
  signal?: GenericAbortSignal;
@@ -429,7 +431,7 @@ export class AxiosError<T = unknown, D = any> extends Error {
429
431
  isAxiosError: boolean;
430
432
  status?: number;
431
433
  toJSON: () => object;
432
- cause?: unknown;
434
+ cause?: Error;
433
435
  event?: BrowserProgressEvent;
434
436
  static from<T = unknown, D = any>(
435
437
  error: Error | unknown,
@@ -492,14 +494,32 @@ export interface AxiosInterceptorOptions {
492
494
  runWhen?: (config: InternalAxiosRequestConfig) => boolean;
493
495
  }
494
496
 
495
- type AxiosRequestInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions) => number;
497
+ type AxiosInterceptorFulfilled<T> = (value: T) => T | Promise<T>;
498
+ type AxiosInterceptorRejected = (error: any) => any;
499
+
500
+ type AxiosRequestInterceptorUse<T> = (
501
+ onFulfilled?: AxiosInterceptorFulfilled<T> | null,
502
+ onRejected?: AxiosInterceptorRejected | null,
503
+ options?: AxiosInterceptorOptions
504
+ ) => number;
496
505
 
497
- type AxiosResponseInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null) => number;
506
+ type AxiosResponseInterceptorUse<T> = (
507
+ onFulfilled?: AxiosInterceptorFulfilled<T> | null,
508
+ onRejected?: AxiosInterceptorRejected | null
509
+ ) => number;
510
+
511
+ interface AxiosInterceptorHandler<T> {
512
+ fulfilled: AxiosInterceptorFulfilled<T>;
513
+ rejected?: AxiosInterceptorRejected;
514
+ synchronous: boolean;
515
+ runWhen: (config: AxiosRequestConfig) => boolean | null;
516
+ }
498
517
 
499
518
  export interface AxiosInterceptorManager<V> {
500
519
  use: V extends AxiosResponse ? AxiosResponseInterceptorUse<V> : AxiosRequestInterceptorUse<V>;
501
520
  eject(id: number): void;
502
521
  clear(): void;
522
+ handlers?: Array<AxiosInterceptorHandler<V>>;
503
523
  }
504
524
 
505
525
  export class Axios {
@@ -5,7 +5,7 @@ The modules under `adapters/` are modules that handle dispatching a request and
5
5
  ## Example
6
6
 
7
7
  ```js
8
- var settle = require('./../core/settle');
8
+ var settle = require('../core/settle');
9
9
 
10
10
  module.exports = function myAdapter(config) {
11
11
  // At this point:
@@ -1,11 +1,11 @@
1
- import { connect, constants } from 'http2';
2
- import utils from './../utils.js';
3
- import settle from './../core/settle.js';
1
+ import utils from '../utils.js';
2
+ import settle from '../core/settle.js';
4
3
  import buildFullPath from '../core/buildFullPath.js';
5
- import buildURL from './../helpers/buildURL.js';
4
+ import buildURL from '../helpers/buildURL.js';
6
5
  import proxyFromEnv from 'proxy-from-env';
7
6
  import http from 'http';
8
7
  import https from 'https';
8
+ import http2 from 'http2';
9
9
  import util from 'util';
10
10
  import followRedirects from 'follow-redirects';
11
11
  import zlib from 'zlib';
@@ -36,13 +36,6 @@ const brotliOptions = {
36
36
  finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
37
37
  }
38
38
 
39
- const {
40
- HTTP2_HEADER_SCHEME,
41
- HTTP2_HEADER_METHOD,
42
- HTTP2_HEADER_PATH,
43
- HTTP2_HEADER_STATUS
44
- } = constants;
45
-
46
39
  const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
47
40
 
48
41
  const {http: httpFollow, https: httpsFollow} = followRedirects;
@@ -72,9 +65,9 @@ class Http2Sessions {
72
65
  sessionTimeout: 1000
73
66
  }, options);
74
67
 
75
- let authoritySessions;
68
+ let authoritySessions = this.sessions[authority];
76
69
 
77
- if ((authoritySessions = this.sessions[authority])) {
70
+ if (authoritySessions) {
78
71
  let len = authoritySessions.length;
79
72
 
80
73
  for (let i = 0; i < len; i++) {
@@ -85,7 +78,7 @@ class Http2Sessions {
85
78
  }
86
79
  }
87
80
 
88
- const session = connect(authority, options);
81
+ const session = http2.connect(authority, options);
89
82
 
90
83
  let removed;
91
84
 
@@ -100,11 +93,12 @@ class Http2Sessions {
100
93
 
101
94
  while (i--) {
102
95
  if (entries[i][0] === session) {
103
- entries.splice(i, 1);
104
96
  if (len === 1) {
105
97
  delete this.sessions[authority];
106
- return;
98
+ } else {
99
+ entries.splice(i, 1);
107
100
  }
101
+ return;
108
102
  }
109
103
  }
110
104
  };
@@ -143,12 +137,12 @@ class Http2Sessions {
143
137
 
144
138
  session.once('close', removeSession);
145
139
 
146
- let entries = this.sessions[authority], entry = [
147
- session,
148
- options
149
- ];
140
+ let entry = [
141
+ session,
142
+ options
143
+ ];
150
144
 
151
- entries ? this.sessions[authority].push(entry) : authoritySessions = this.sessions[authority] = [entry];
145
+ authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
152
146
 
153
147
  return session;
154
148
  }
@@ -199,12 +193,16 @@ function setProxy(options, configProxy, location) {
199
193
 
200
194
  if (proxy.auth) {
201
195
  // Support proxy auth object form
202
- if (proxy.auth.username || proxy.auth.password) {
196
+ const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
197
+
198
+ if (validProxyAuth) {
203
199
  proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
200
+ } else if (typeof proxy.auth === 'object') {
201
+ throw new AxiosError('Invalid proxy authorization', AxiosError.ERR_BAD_OPTION, { proxy });
204
202
  }
205
- const base64 = Buffer
206
- .from(proxy.auth, 'utf8')
207
- .toString('base64');
203
+
204
+ const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64');
205
+
208
206
  options.headers['Proxy-Authorization'] = 'Basic ' + base64;
209
207
  }
210
208
 
@@ -270,12 +268,20 @@ const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(addr
270
268
 
271
269
  const http2Transport = {
272
270
  request(options, cb) {
273
- const authority = options.protocol + '//' + options.hostname + ':' + (options.port || 80);
271
+ const authority = options.protocol + '//' + options.hostname + ':' + (options.port ||(options.protocol === 'https:' ? 443 : 80));
272
+
274
273
 
275
274
  const {http2Options, headers} = options;
276
275
 
277
276
  const session = http2Sessions.getSession(authority, http2Options);
278
277
 
278
+ const {
279
+ HTTP2_HEADER_SCHEME,
280
+ HTTP2_HEADER_METHOD,
281
+ HTTP2_HEADER_PATH,
282
+ HTTP2_HEADER_STATUS
283
+ } = http2.constants;
284
+
279
285
  const http2Headers = {
280
286
  [HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
281
287
  [HTTP2_HEADER_METHOD]: options.method,
@@ -811,8 +817,6 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
811
817
 
812
818
  // Handle errors
813
819
  req.on('error', function handleRequestError(err) {
814
- // @todo remove
815
- // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
816
820
  reject(AxiosError.from(err, null, config, req));
817
821
  });
818
822
 
@@ -857,6 +861,9 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
857
861
  req
858
862
  ));
859
863
  });
864
+ } else {
865
+ // explicitly reset the socket timeout value for a possible `keep-alive` request
866
+ req.setTimeout(0);
860
867
  }
861
868
 
862
869
 
@@ -1,5 +1,5 @@
1
- import utils from './../utils.js';
2
- import settle from './../core/settle.js';
1
+ import utils from '../utils.js';
2
+ import settle from '../core/settle.js';
3
3
  import transitionalDefaults from '../defaults/transitional.js';
4
4
  import AxiosError from '../core/AxiosError.js';
5
5
  import CanceledError from '../cancel/CanceledError.js';
@@ -1,25 +1,22 @@
1
1
  'use strict';
2
2
 
3
3
  import AxiosError from '../core/AxiosError.js';
4
- import utils from '../utils.js';
5
4
 
6
- /**
7
- * A `CanceledError` is an object that is thrown when an operation is canceled.
8
- *
9
- * @param {string=} message The message.
10
- * @param {Object=} config The config.
11
- * @param {Object=} request The request.
12
- *
13
- * @returns {CanceledError} The created error.
14
- */
15
- function CanceledError(message, config, request) {
16
- // eslint-disable-next-line no-eq-null,eqeqeq
17
- AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
18
- this.name = 'CanceledError';
5
+ class CanceledError extends AxiosError {
6
+ /**
7
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
8
+ *
9
+ * @param {string=} message The message.
10
+ * @param {Object=} config The config.
11
+ * @param {Object=} request The request.
12
+ *
13
+ * @returns {CanceledError} The created error.
14
+ */
15
+ constructor(message, config, request) {
16
+ super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
17
+ this.name = 'CanceledError';
18
+ this.__CANCEL__ = true;
19
+ }
19
20
  }
20
21
 
21
- utils.inherits(CanceledError, AxiosError, {
22
- __CANCEL__: true
23
- });
24
-
25
22
  export default CanceledError;
package/lib/core/Axios.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- import utils from './../utils.js';
3
+ import utils from '../utils.js';
4
4
  import buildURL from '../helpers/buildURL.js';
5
5
  import InterceptorManager from './InterceptorManager.js';
6
6
  import dispatchRequest from './dispatchRequest.js';
@@ -159,8 +159,13 @@ class Axios {
159
159
 
160
160
  promise = Promise.resolve(config);
161
161
 
162
+ let prevResult = config;
162
163
  while (i < len) {
163
- promise = promise.then(chain[i++], chain[i++]);
164
+ promise = promise
165
+ .then(chain[i++])
166
+ .then(result => { prevResult = result !== undefined ? result : prevResult })
167
+ .catch(chain[i++])
168
+ .then(() => prevResult);
164
169
  }
165
170
 
166
171
  return promise;
@@ -191,7 +196,7 @@ class Axios {
191
196
  len = responseInterceptorChain.length;
192
197
 
193
198
  while (i < len) {
194
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
199
+ promise = promise.then(responseInterceptorChain[i++]).catch(responseInterceptorChain[i++]);
195
200
  }
196
201
 
197
202
  return promise;
@@ -2,109 +2,72 @@
2
2
 
3
3
  import utils from '../utils.js';
4
4
 
5
- /**
6
- * Create an Error with the specified message, config, error code, request and response.
7
- *
8
- * @param {string} message The error message.
9
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
10
- * @param {Object} [config] The config.
11
- * @param {Object} [request] The request.
12
- * @param {Object} [response] The response.
13
- *
14
- * @returns {Error} The created error.
15
- */
16
- function AxiosError(message, code, config, request, response) {
17
- Error.call(this);
18
-
19
- if (Error.captureStackTrace) {
20
- Error.captureStackTrace(this, this.constructor);
21
- } else {
22
- this.stack = (new Error()).stack;
23
- }
24
-
25
- this.message = message;
26
- this.name = 'AxiosError';
27
- code && (this.code = code);
28
- config && (this.config = config);
29
- request && (this.request = request);
30
- if (response) {
31
- this.response = response;
32
- this.status = response.status ? response.status : null;
33
- }
5
+ class AxiosError extends Error {
6
+ static from(error, code, config, request, response, customProps) {
7
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
8
+ axiosError.cause = error;
9
+ axiosError.name = error.name;
10
+ customProps && Object.assign(axiosError, customProps);
11
+ return axiosError;
12
+ }
13
+
14
+ /**
15
+ * Create an Error with the specified message, config, error code, request and response.
16
+ *
17
+ * @param {string} message The error message.
18
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
19
+ * @param {Object} [config] The config.
20
+ * @param {Object} [request] The request.
21
+ * @param {Object} [response] The response.
22
+ *
23
+ * @returns {Error} The created error.
24
+ */
25
+ constructor(message, code, config, request, response) {
26
+ super(message);
27
+ this.name = 'AxiosError';
28
+ this.isAxiosError = true;
29
+ code && (this.code = code);
30
+ config && (this.config = config);
31
+ request && (this.request = request);
32
+ if (response) {
33
+ this.response = response;
34
+ this.status = response.status;
35
+ }
36
+ }
37
+
38
+ toJSON() {
39
+ return {
40
+ // Standard
41
+ message: this.message,
42
+ name: this.name,
43
+ // Microsoft
44
+ description: this.description,
45
+ number: this.number,
46
+ // Mozilla
47
+ fileName: this.fileName,
48
+ lineNumber: this.lineNumber,
49
+ columnNumber: this.columnNumber,
50
+ stack: this.stack,
51
+ // Axios
52
+ config: utils.toJSONObject(this.config),
53
+ code: this.code,
54
+ status: this.status,
55
+ };
56
+ }
34
57
  }
35
58
 
36
- utils.inherits(AxiosError, Error, {
37
- toJSON: function toJSON() {
38
- return {
39
- // Standard
40
- message: this.message,
41
- name: this.name,
42
- // Microsoft
43
- description: this.description,
44
- number: this.number,
45
- // Mozilla
46
- fileName: this.fileName,
47
- lineNumber: this.lineNumber,
48
- columnNumber: this.columnNumber,
49
- stack: this.stack,
50
- // Axios
51
- config: utils.toJSONObject(this.config),
52
- code: this.code,
53
- status: this.status
54
- };
55
- }
56
- });
57
-
58
- const prototype = AxiosError.prototype;
59
- const descriptors = {};
60
-
61
- [
62
- 'ERR_BAD_OPTION_VALUE',
63
- 'ERR_BAD_OPTION',
64
- 'ECONNABORTED',
65
- 'ETIMEDOUT',
66
- 'ERR_NETWORK',
67
- 'ERR_FR_TOO_MANY_REDIRECTS',
68
- 'ERR_DEPRECATED',
69
- 'ERR_BAD_RESPONSE',
70
- 'ERR_BAD_REQUEST',
71
- 'ERR_CANCELED',
72
- 'ERR_NOT_SUPPORT',
73
- 'ERR_INVALID_URL'
74
- // eslint-disable-next-line func-names
75
- ].forEach(code => {
76
- descriptors[code] = {value: code};
77
- });
78
-
79
- Object.defineProperties(AxiosError, descriptors);
80
- Object.defineProperty(prototype, 'isAxiosError', {value: true});
81
-
82
- // eslint-disable-next-line func-names
83
- AxiosError.from = (error, code, config, request, response, customProps) => {
84
- const axiosError = Object.create(prototype);
85
-
86
- utils.toFlatObject(error, axiosError, function filter(obj) {
87
- return obj !== Error.prototype;
88
- }, prop => {
89
- return prop !== 'isAxiosError';
90
- });
91
-
92
- const msg = error && error.message ? error.message : 'Error';
93
-
94
- // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
95
- const errCode = code == null && error ? error.code : code;
96
- AxiosError.call(axiosError, msg, errCode, config, request, response);
97
-
98
- // Chain the original error on the standard field; non-enumerable to avoid JSON noise
99
- if (error && axiosError.cause == null) {
100
- Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
101
- }
102
-
103
- axiosError.name = (error && error.name) || 'Error';
104
-
105
- customProps && Object.assign(axiosError, customProps);
106
-
107
- return axiosError;
108
- };
59
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
60
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
61
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
62
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
63
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
64
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
65
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
66
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
67
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
68
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
69
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
70
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
71
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
109
72
 
110
73
  export default AxiosError;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- import utils from './../utils.js';
3
+ import utils from '../utils.js';
4
4
 
5
5
  class InterceptorManager {
6
6
  constructor() {
@@ -12,6 +12,7 @@ class InterceptorManager {
12
12
  *
13
13
  * @param {Function} fulfilled The function to handle `then` for a `Promise`
14
14
  * @param {Function} rejected The function to handle `reject` for a `Promise`
15
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
15
16
  *
16
17
  * @return {Number} An ID used to remove interceptor later
17
18
  */
@@ -21,7 +21,7 @@ export default function mergeConfig(config1, config2) {
21
21
 
22
22
  function getMergedValue(target, source, prop, caseless) {
23
23
  if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
24
- return utils.merge.call({caseless}, target, source);
24
+ return utils.merge.call({ caseless }, target, source);
25
25
  } else if (utils.isPlainObject(source)) {
26
26
  return utils.merge({}, source);
27
27
  } else if (utils.isArray(source)) {
@@ -30,7 +30,6 @@ export default function mergeConfig(config1, config2) {
30
30
  return source;
31
31
  }
32
32
 
33
- // eslint-disable-next-line consistent-return
34
33
  function mergeDeepProperties(a, b, prop, caseless) {
35
34
  if (!utils.isUndefined(b)) {
36
35
  return getMergedValue(a, b, prop, caseless);
@@ -96,7 +95,7 @@ export default function mergeConfig(config1, config2) {
96
95
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
97
96
  };
98
97
 
99
- utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
98
+ utils.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
100
99
  const merge = mergeMap[prop] || mergeDeepProperties;
101
100
  const configValue = merge(config1[prop], config2[prop], prop);
102
101
  (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- import utils from './../utils.js';
3
+ import utils from '../utils.js';
4
4
  import defaults from '../defaults/index.js';
5
5
  import AxiosHeaders from '../core/AxiosHeaders.js';
6
6
 
package/lib/env/data.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.13.1";
1
+ export const VERSION = "1.13.3";
@@ -29,29 +29,26 @@ function encode(val) {
29
29
  * @returns {string} The formatted url
30
30
  */
31
31
  export default function buildURL(url, params, options) {
32
- /*eslint no-param-reassign:0*/
33
32
  if (!params) {
34
33
  return url;
35
34
  }
36
-
35
+
37
36
  const _encode = options && options.encode || encode;
38
37
 
39
- if (utils.isFunction(options)) {
40
- options = {
41
- serialize: options
42
- };
43
- }
38
+ const _options = utils.isFunction(options) ? {
39
+ serialize: options
40
+ } : options;
44
41
 
45
- const serializeFn = options && options.serialize;
42
+ const serializeFn = _options && _options.serialize;
46
43
 
47
44
  let serializedParams;
48
45
 
49
46
  if (serializeFn) {
50
- serializedParams = serializeFn(params, options);
47
+ serializedParams = serializeFn(params, _options);
51
48
  } else {
52
49
  serializedParams = utils.isURLSearchParams(params) ?
53
50
  params.toString() :
54
- new AxiosURLSearchParams(params, options).toString(_encode);
51
+ new AxiosURLSearchParams(params, _options).toString(_encode);
55
52
  }
56
53
 
57
54
  if (serializedParams) {
@@ -21,7 +21,7 @@ const composeSignals = (signals, timeout) => {
21
21
 
22
22
  let timer = timeout && setTimeout(() => {
23
23
  timer = null;
24
- onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))
24
+ onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT))
25
25
  }, timeout)
26
26
 
27
27
  const unsubscribe = () => {
@@ -1,4 +1,4 @@
1
- import utils from './../utils.js';
1
+ import utils from '../utils.js';
2
2
  import platform from '../platform/index.js';
3
3
 
4
4
  export default platform.hasStandardBrowserEnv ?
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- import utils from './../utils.js';
3
+ import utils from '../utils.js';
4
4
 
5
5
  /**
6
6
  * Determines whether the payload is an error thrown by Axios
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- import utils from './../utils.js';
3
+ import utils from '../utils.js';
4
4
 
5
5
  // RawAxiosHeaders whose duplicates are ignored by node
6
6
  // c.f. https://nodejs.org/api/http.html#http_message_headers