axios 1.2.2 → 1.2.4

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
@@ -1,14 +1,13 @@
1
1
  type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
2
- type RawAxiosHeaders = Record<string, AxiosHeaderValue>;
3
2
 
4
- type MethodsHeaders = {
5
- [Key in axios.Method as Lowercase<Key>]: AxiosHeaders;
6
- };
7
-
8
- interface CommonHeaders {
9
- common: AxiosHeaders;
3
+ interface RawAxiosHeaders {
4
+ [key: string]: AxiosHeaderValue;
10
5
  }
11
6
 
7
+ type MethodsHeaders = Partial<{
8
+ [Key in axios.Method as Lowercase<Key>]: AxiosHeaders;
9
+ } & {common: AxiosHeaders}>;
10
+
12
11
  type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
13
12
 
14
13
  type AxiosHeaderSetter = (value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher) => AxiosHeaders;
@@ -23,6 +22,8 @@ declare class AxiosHeaders {
23
22
  headers?: RawAxiosHeaders | AxiosHeaders
24
23
  );
25
24
 
25
+ [key: string]: any;
26
+
26
27
  set(headerName?: string, value?: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
27
28
  set(headers?: RawAxiosHeaders | AxiosHeaders, rewrite?: boolean): AxiosHeaders;
28
29
 
@@ -66,18 +67,20 @@ declare class AxiosHeaders {
66
67
  setContentEncoding: AxiosHeaderSetter;
67
68
  getContentEncoding: AxiosHeaderGetter;
68
69
  hasContentEncoding: AxiosHeaderTester;
70
+
71
+ [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
69
72
  }
70
73
 
71
74
  declare class AxiosError<T = unknown, D = any> extends Error {
72
75
  constructor(
73
76
  message?: string,
74
77
  code?: string,
75
- config?: axios.AxiosRequestConfig<D>,
78
+ config?: axios.InternalAxiosRequestConfig<D>,
76
79
  request?: any,
77
80
  response?: axios.AxiosResponse<T, D>
78
81
  );
79
82
 
80
- config?: axios.AxiosRequestConfig<D>;
83
+ config?: axios.InternalAxiosRequestConfig<D>;
81
84
  code?: string;
82
85
  request?: any;
83
86
  response?: axios.AxiosResponse<T, D>;
@@ -106,7 +109,7 @@ declare class Axios {
106
109
  constructor(config?: axios.AxiosRequestConfig);
107
110
  defaults: axios.AxiosDefaults;
108
111
  interceptors: {
109
- request: axios.AxiosInterceptorManager<axios.AxiosRequestConfig>;
112
+ request: axios.AxiosInterceptorManager<axios.InternalAxiosRequestConfig>;
110
113
  response: axios.AxiosInterceptorManager<axios.AxiosResponse>;
111
114
  };
112
115
  getUri(config?: axios.AxiosRequestConfig): string;
@@ -194,26 +197,36 @@ type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
194
197
  declare namespace axios {
195
198
  type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
196
199
 
197
- type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>;
200
+ type CommonRequestHeadersList = 'Accept' | 'Content-Type' | 'Content-Length' | 'User-Agent'| 'Content-Encoding';
201
+
202
+ type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
203
+ [Key in CommonRequestHeadersList]: AxiosHeaderValue;
204
+ }>;
198
205
 
199
206
  type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
200
207
 
201
- type RawAxiosResponseHeaders = Partial<Record<string, string> & {
202
- "set-cookie"?: string[]
203
- }>;
208
+ type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
209
+
210
+ type RawCommonResponseHeaders = {
211
+ [Key in CommonResponseHeadersList]: AxiosHeaderValue;
212
+ } & {
213
+ "set-cookie": string[];
214
+ };
215
+
216
+ type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
204
217
 
205
218
  type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
206
219
 
207
220
  interface AxiosRequestTransformer {
208
- (this: AxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
221
+ (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
209
222
  }
210
223
 
211
224
  interface AxiosResponseTransformer {
212
- (this: AxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
225
+ (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
213
226
  }
214
227
 
215
228
  interface AxiosAdapter {
216
- (config: AxiosRequestConfig): AxiosPromise;
229
+ (config: InternalAxiosRequestConfig): AxiosPromise;
217
230
  }
218
231
 
219
232
  interface AxiosBasicCredentials {
@@ -348,7 +361,7 @@ declare namespace axios {
348
361
  baseURL?: string;
349
362
  transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
350
363
  transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
351
- headers?: RawAxiosRequestHeaders | AxiosHeaders;
364
+ headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
352
365
  params?: any;
353
366
  paramsSerializer?: ParamsSerializerOptions;
354
367
  data?: D;
@@ -384,6 +397,13 @@ declare namespace axios {
384
397
  formSerializer?: FormSerializerOptions;
385
398
  }
386
399
 
400
+ // Alias
401
+ type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
402
+
403
+ interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig {
404
+ headers: AxiosRequestHeaders;
405
+ }
406
+
387
407
  interface HeadersDefaults {
388
408
  common: RawAxiosRequestHeaders;
389
409
  delete: RawAxiosRequestHeaders;
@@ -411,7 +431,7 @@ declare namespace axios {
411
431
  status: number;
412
432
  statusText: string;
413
433
  headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
414
- config: AxiosRequestConfig<D>;
434
+ config: InternalAxiosRequestConfig<D>;
415
435
  request?: any;
416
436
  }
417
437
 
@@ -447,7 +467,7 @@ declare namespace axios {
447
467
 
448
468
  interface AxiosInterceptorOptions {
449
469
  synchronous?: boolean;
450
- runWhen?: (config: AxiosRequestConfig) => boolean;
470
+ runWhen?: (config: InternalAxiosRequestConfig) => boolean;
451
471
  }
452
472
 
453
473
  interface AxiosInterceptorManager<V> {
package/index.d.ts CHANGED
@@ -1,15 +1,14 @@
1
1
  // TypeScript Version: 4.7
2
2
  type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
3
- type RawAxiosHeaders = Record<string, AxiosHeaderValue>;
4
3
 
5
- type MethodsHeaders = {
6
- [Key in Method as Lowercase<Key>]: AxiosHeaders;
7
- };
8
-
9
- interface CommonHeaders {
10
- common: AxiosHeaders;
4
+ interface RawAxiosHeaders {
5
+ [key: string]: AxiosHeaderValue;
11
6
  }
12
7
 
8
+ type MethodsHeaders = Partial<{
9
+ [Key in Method as Lowercase<Key>]: AxiosHeaders;
10
+ } & {common: AxiosHeaders}>;
11
+
13
12
  type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
14
13
 
15
14
  type AxiosHeaderSetter = (value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher) => AxiosHeaders;
@@ -24,6 +23,8 @@ export class AxiosHeaders {
24
23
  headers?: RawAxiosHeaders | AxiosHeaders
25
24
  );
26
25
 
26
+ [key: string]: any;
27
+
27
28
  set(headerName?: string, value?: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
28
29
  set(headers?: RawAxiosHeaders | AxiosHeaders, rewrite?: boolean): AxiosHeaders;
29
30
 
@@ -67,28 +68,40 @@ export class AxiosHeaders {
67
68
  setContentEncoding: AxiosHeaderSetter;
68
69
  getContentEncoding: AxiosHeaderGetter;
69
70
  hasContentEncoding: AxiosHeaderTester;
71
+
72
+ [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
70
73
  }
71
74
 
72
- export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>;
75
+ type CommonRequestHeadersList = 'Accept' | 'Content-Type' | 'Content-Length' | 'User-Agent'| 'Content-Encoding';
76
+
77
+ export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
78
+ [Key in CommonRequestHeadersList]: AxiosHeaderValue;
79
+ }>;
73
80
 
74
81
  export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
75
82
 
76
- export type RawAxiosResponseHeaders = Partial<Record<string, string> & {
77
- "set-cookie"?: string[]
78
- }>;
83
+ type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
84
+
85
+ type RawCommonResponseHeaders = {
86
+ [Key in CommonResponseHeadersList]: AxiosHeaderValue;
87
+ } & {
88
+ "set-cookie": string[];
89
+ };
90
+
91
+ export type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
79
92
 
80
93
  export type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
81
94
 
82
95
  export interface AxiosRequestTransformer {
83
- (this: AxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
96
+ (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
84
97
  }
85
98
 
86
99
  export interface AxiosResponseTransformer {
87
- (this: AxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
100
+ (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
88
101
  }
89
102
 
90
103
  export interface AxiosAdapter {
91
- (config: AxiosRequestConfig): AxiosPromise;
104
+ (config: InternalAxiosRequestConfig): AxiosPromise;
92
105
  }
93
106
 
94
107
  export interface AxiosBasicCredentials {
@@ -289,7 +302,7 @@ export interface AxiosRequestConfig<D = any> {
289
302
  baseURL?: string;
290
303
  transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
291
304
  transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
292
- headers?: RawAxiosRequestHeaders | AxiosHeaders;
305
+ headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
293
306
  params?: any;
294
307
  paramsSerializer?: ParamsSerializerOptions;
295
308
  data?: D;
@@ -325,6 +338,13 @@ export interface AxiosRequestConfig<D = any> {
325
338
  formSerializer?: FormSerializerOptions;
326
339
  }
327
340
 
341
+ // Alias
342
+ export type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
343
+
344
+ export interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
345
+ headers: AxiosRequestHeaders;
346
+ }
347
+
328
348
  export interface HeadersDefaults {
329
349
  common: RawAxiosRequestHeaders;
330
350
  delete: RawAxiosRequestHeaders;
@@ -352,7 +372,7 @@ export interface AxiosResponse<T = any, D = any> {
352
372
  status: number;
353
373
  statusText: string;
354
374
  headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
355
- config: AxiosRequestConfig<D>;
375
+ config: InternalAxiosRequestConfig<D>;
356
376
  request?: any;
357
377
  }
358
378
 
@@ -360,12 +380,12 @@ export class AxiosError<T = unknown, D = any> extends Error {
360
380
  constructor(
361
381
  message?: string,
362
382
  code?: string,
363
- config?: AxiosRequestConfig<D>,
383
+ config?: InternalAxiosRequestConfig<D>,
364
384
  request?: any,
365
385
  response?: AxiosResponse<T, D>
366
386
  );
367
387
 
368
- config?: AxiosRequestConfig<D>;
388
+ config?: InternalAxiosRequestConfig<D>;
369
389
  code?: string;
370
390
  request?: any;
371
391
  response?: AxiosResponse<T, D>;
@@ -376,7 +396,7 @@ export class AxiosError<T = unknown, D = any> extends Error {
376
396
  static from<T = unknown, D = any>(
377
397
  error: Error | unknown,
378
398
  code?: string,
379
- config?: AxiosRequestConfig<D>,
399
+ config?: InternalAxiosRequestConfig<D>,
380
400
  request?: any,
381
401
  response?: AxiosResponse<T, D>,
382
402
  customProps?: object,
@@ -430,7 +450,7 @@ export interface CancelTokenSource {
430
450
 
431
451
  export interface AxiosInterceptorOptions {
432
452
  synchronous?: boolean;
433
- runWhen?: (config: AxiosRequestConfig) => boolean;
453
+ runWhen?: (config: InternalAxiosRequestConfig) => boolean;
434
454
  }
435
455
 
436
456
  export interface AxiosInterceptorManager<V> {
@@ -443,7 +463,7 @@ export class Axios {
443
463
  constructor(config?: AxiosRequestConfig);
444
464
  defaults: AxiosDefaults;
445
465
  interceptors: {
446
- request: AxiosInterceptorManager<AxiosRequestConfig>;
466
+ request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
447
467
  response: AxiosInterceptorManager<AxiosResponse>;
448
468
  };
449
469
  getUri(config?: AxiosRequestConfig): string;
package/lib/env/data.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.2.2";
1
+ export const VERSION = "1.2.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -32,7 +32,7 @@
32
32
  "test:karma:server": "node bin/ssl_hotfix.js cross-env karma start karma.conf.cjs",
33
33
  "test:build:version": "node ./bin/check-build-version.js",
34
34
  "start": "node ./sandbox/server.js",
35
- "preversion": "gulp version && npm test",
35
+ "preversion": "gulp version",
36
36
  "version": "npm run build && git add dist && git add package.json",
37
37
  "prepublishOnly": "npm run test:build:version",
38
38
  "postpublish": "git push && git push --tags",
@@ -47,7 +47,7 @@
47
47
  "release:beta:no-npm": "release-it --preRelease=beta --no-npm",
48
48
  "release:beta": "release-it --preRelease=beta",
49
49
  "release:no-npm": "release-it --no-npm",
50
- "release:changelog:fix": "node ./bin/injectContributorsList.js",
50
+ "release:changelog:fix": "node ./bin/injectContributorsList.js && git add CHANGELOG.md",
51
51
  "release": "release-it"
52
52
  },
53
53
  "repository": {
@@ -81,6 +81,7 @@
81
81
  "abortcontroller-polyfill": "^1.7.3",
82
82
  "auto-changelog": "^2.4.0",
83
83
  "body-parser": "^1.20.0",
84
+ "chalk": "^5.2.0",
84
85
  "coveralls": "^3.1.1",
85
86
  "cross-env": "^7.0.3",
86
87
  "dev-null": "^0.1.1",
@@ -92,6 +93,7 @@
92
93
  "fs-extra": "^10.1.0",
93
94
  "get-stream": "^3.0.0",
94
95
  "gulp": "^4.0.2",
96
+ "gzip-size": "^7.0.0",
95
97
  "handlebars": "^4.7.7",
96
98
  "husky": "^8.0.2",
97
99
  "istanbul-instrumenter-loader": "^3.0.1",
@@ -109,6 +111,7 @@
109
111
  "minimist": "^1.2.7",
110
112
  "mocha": "^10.0.0",
111
113
  "multer": "^1.4.4",
114
+ "pretty-bytes": "^6.0.0",
112
115
  "release-it": "^15.5.1",
113
116
  "rollup": "^2.67.0",
114
117
  "rollup-plugin-auto-external": "^2.0.0",
@@ -158,10 +161,15 @@
158
161
  "sideEffects": false,
159
162
  "release-it": {
160
163
  "git": {
161
- "commitMessage": "chore(release): v${version}"
164
+ "commitMessage": "chore(release): v${version}",
165
+ "push": true,
166
+ "commit": true,
167
+ "tag": true,
168
+ "requireCommits": false
162
169
  },
163
170
  "github": {
164
- "release": true
171
+ "release": true,
172
+ "draft": true
165
173
  },
166
174
  "npm": {
167
175
  "publish": false,
@@ -177,7 +185,7 @@
177
185
  "hooks": {
178
186
  "before:init": "npm test",
179
187
  "after:bump": "gulp version --bump ${version} && npm run build && npm run test:build:version && git add ./dist",
180
- "before:release": "npm run release:changelog:fix && git add CHANGELOG.md",
188
+ "before:release": "npm run release:changelog:fix",
181
189
  "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
182
190
  }
183
191
  },
package/lib/.DS_Store DELETED
Binary file