axios 1.2.3 → 1.2.5

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,28 +1,22 @@
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
 
12
- type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
13
-
14
- type AxiosHeaderSetter = (value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher) => AxiosHeaders;
15
-
16
- type AxiosHeaderGetter = ((parser?: RegExp) => RegExpExecArray | null) |
17
- ((matcher?: AxiosHeaderMatcher) => AxiosHeaderValue);
7
+ type MethodsHeaders = Partial<{
8
+ [Key in axios.Method as Lowercase<Key>]: AxiosHeaders;
9
+ } & {common: AxiosHeaders}>;
18
10
 
19
- type AxiosHeaderTester = (matcher?: AxiosHeaderMatcher) => boolean;
11
+ type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
20
12
 
21
13
  declare class AxiosHeaders {
22
14
  constructor(
23
15
  headers?: RawAxiosHeaders | AxiosHeaders
24
16
  );
25
17
 
18
+ [key: string]: any;
19
+
26
20
  set(headerName?: string, value?: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
27
21
  set(headers?: RawAxiosHeaders | AxiosHeaders, rewrite?: boolean): AxiosHeaders;
28
22
 
@@ -37,7 +31,7 @@ declare class AxiosHeaders {
37
31
 
38
32
  normalize(format: boolean): AxiosHeaders;
39
33
 
40
- concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string>): AxiosHeaders;
34
+ concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
41
35
 
42
36
  toJSON(asStrings?: boolean): RawAxiosHeaders;
43
37
 
@@ -45,39 +39,51 @@ declare class AxiosHeaders {
45
39
 
46
40
  static accessor(header: string | string[]): AxiosHeaders;
47
41
 
48
- static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string>): AxiosHeaders;
42
+ static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
43
+
44
+ setContentType(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
45
+ getContentType(parser?: RegExp): RegExpExecArray | null;
46
+ getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
47
+ hasContentType(matcher?: AxiosHeaderMatcher): boolean;
49
48
 
50
- setContentType: AxiosHeaderSetter;
51
- getContentType: AxiosHeaderGetter;
52
- hasContentType: AxiosHeaderTester;
49
+ setContentLength(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
50
+ getContentLength(parser?: RegExp): RegExpExecArray | null;
51
+ getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
52
+ hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
53
53
 
54
- setContentLength: AxiosHeaderSetter;
55
- getContentLength: AxiosHeaderGetter;
56
- hasContentLength: AxiosHeaderTester;
54
+ setAccept(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
55
+ getAccept(parser?: RegExp): RegExpExecArray | null;
56
+ getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
57
+ hasAccept(matcher?: AxiosHeaderMatcher): boolean;
57
58
 
58
- setAccept: AxiosHeaderSetter;
59
- getAccept: AxiosHeaderGetter;
60
- hasAccept: AxiosHeaderTester;
59
+ setUserAgent(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
60
+ getUserAgent(parser?: RegExp): RegExpExecArray | null;
61
+ getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
62
+ hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
61
63
 
62
- setUserAgent: AxiosHeaderSetter;
63
- getUserAgent: AxiosHeaderGetter;
64
- hasUserAgent: AxiosHeaderTester;
64
+ setContentEncoding(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
65
+ getContentEncoding(parser?: RegExp): RegExpExecArray | null;
66
+ getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
67
+ hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
65
68
 
66
- setContentEncoding: AxiosHeaderSetter;
67
- getContentEncoding: AxiosHeaderGetter;
68
- hasContentEncoding: AxiosHeaderTester;
69
+ setAuthorization(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
70
+ getAuthorization(parser?: RegExp): RegExpExecArray | null;
71
+ getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
72
+ hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
73
+
74
+ [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
69
75
  }
70
76
 
71
77
  declare class AxiosError<T = unknown, D = any> extends Error {
72
78
  constructor(
73
79
  message?: string,
74
80
  code?: string,
75
- config?: axios.AxiosRequestConfig<D>,
81
+ config?: axios.InternalAxiosRequestConfig<D>,
76
82
  request?: any,
77
83
  response?: axios.AxiosResponse<T, D>
78
84
  );
79
85
 
80
- config?: axios.AxiosRequestConfig<D>;
86
+ config?: axios.InternalAxiosRequestConfig<D>;
81
87
  code?: string;
82
88
  request?: any;
83
89
  response?: axios.AxiosResponse<T, D>;
@@ -103,24 +109,24 @@ declare class CanceledError<T> extends AxiosError<T> {
103
109
  }
104
110
 
105
111
  declare class Axios {
106
- constructor(config?: axios.RawAxiosRequestConfig);
112
+ constructor(config?: axios.AxiosRequestConfig);
107
113
  defaults: axios.AxiosDefaults;
108
114
  interceptors: {
109
- request: axios.AxiosInterceptorManager<axios.AxiosRequestConfig>;
115
+ request: axios.AxiosInterceptorManager<axios.InternalAxiosRequestConfig>;
110
116
  response: axios.AxiosInterceptorManager<axios.AxiosResponse>;
111
117
  };
112
- getUri(config?: axios.RawAxiosRequestConfig): string;
113
- request<T = any, R = axios.AxiosResponse<T>, D = any>(config: axios.RawAxiosRequestConfig<D>): Promise<R>;
114
- get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
115
- delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
116
- head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
117
- options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
118
- post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
119
- put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
120
- patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
121
- postForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
122
- putForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
123
- patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
118
+ getUri(config?: axios.AxiosRequestConfig): string;
119
+ request<T = any, R = axios.AxiosResponse<T>, D = any>(config: axios.AxiosRequestConfig<D>): Promise<R>;
120
+ get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
121
+ delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
122
+ head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
123
+ options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
124
+ post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
125
+ put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
126
+ patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
127
+ postForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
128
+ putForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
129
+ patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
124
130
  }
125
131
 
126
132
  declare enum HttpStatusCode {
@@ -194,26 +200,36 @@ type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
194
200
  declare namespace axios {
195
201
  type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
196
202
 
197
- type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>;
203
+ type CommonRequestHeadersList = 'Accept' | 'Content-Type' | 'Content-Length' | 'User-Agent'| 'Content-Encoding';
204
+
205
+ type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
206
+ [Key in CommonRequestHeadersList]: AxiosHeaderValue;
207
+ }>;
198
208
 
199
209
  type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
200
210
 
201
- type RawAxiosResponseHeaders = Partial<Record<string, string> & {
202
- "set-cookie"?: string[]
203
- }>;
211
+ type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
212
+
213
+ type RawCommonResponseHeaders = {
214
+ [Key in CommonResponseHeadersList]: AxiosHeaderValue;
215
+ } & {
216
+ "set-cookie": string[];
217
+ };
218
+
219
+ type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
204
220
 
205
221
  type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
206
222
 
207
223
  interface AxiosRequestTransformer {
208
- (this: AxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
224
+ (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
209
225
  }
210
226
 
211
227
  interface AxiosResponseTransformer {
212
- (this: AxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
228
+ (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
213
229
  }
214
230
 
215
231
  interface AxiosAdapter {
216
- (config: AxiosRequestConfig): AxiosPromise;
232
+ (config: InternalAxiosRequestConfig): AxiosPromise;
217
233
  }
218
234
 
219
235
  interface AxiosBasicCredentials {
@@ -342,13 +358,13 @@ declare namespace axios {
342
358
 
343
359
  type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
344
360
 
345
- interface RawAxiosRequestConfig<D = any> {
361
+ interface AxiosRequestConfig<D = any> {
346
362
  url?: string;
347
363
  method?: Method | string;
348
364
  baseURL?: string;
349
365
  transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
350
366
  transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
351
- headers?: RawAxiosRequestHeaders | AxiosHeaders;
367
+ headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
352
368
  params?: any;
353
369
  paramsSerializer?: ParamsSerializerOptions;
354
370
  data?: D;
@@ -384,7 +400,10 @@ declare namespace axios {
384
400
  formSerializer?: FormSerializerOptions;
385
401
  }
386
402
 
387
- interface AxiosRequestConfig<D = any> extends RawAxiosRequestConfig {
403
+ // Alias
404
+ type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
405
+
406
+ interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig {
388
407
  headers: AxiosRequestHeaders;
389
408
  }
390
409
 
@@ -402,11 +421,11 @@ declare namespace axios {
402
421
  unlink?: RawAxiosRequestHeaders;
403
422
  }
404
423
 
405
- interface AxiosDefaults<D = any> extends Omit<RawAxiosRequestConfig<D>, 'headers'> {
424
+ interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
406
425
  headers: HeadersDefaults;
407
426
  }
408
427
 
409
- interface CreateAxiosDefaults<D = any> extends Omit<RawAxiosRequestConfig<D>, 'headers'> {
428
+ interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
410
429
  headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
411
430
  }
412
431
 
@@ -415,7 +434,7 @@ declare namespace axios {
415
434
  status: number;
416
435
  statusText: string;
417
436
  headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
418
- config: AxiosRequestConfig<D>;
437
+ config: InternalAxiosRequestConfig<D>;
419
438
  request?: any;
420
439
  }
421
440
 
@@ -430,7 +449,7 @@ declare namespace axios {
430
449
  }
431
450
 
432
451
  interface Canceler {
433
- (message?: string, config?: RawAxiosRequestConfig, request?: any): void;
452
+ (message?: string, config?: AxiosRequestConfig, request?: any): void;
434
453
  }
435
454
 
436
455
  interface CancelTokenStatic {
@@ -451,7 +470,7 @@ declare namespace axios {
451
470
 
452
471
  interface AxiosInterceptorOptions {
453
472
  synchronous?: boolean;
454
- runWhen?: (config: AxiosRequestConfig) => boolean;
473
+ runWhen?: (config: InternalAxiosRequestConfig) => boolean;
455
474
  }
456
475
 
457
476
  interface AxiosInterceptorManager<V> {
@@ -461,8 +480,8 @@ declare namespace axios {
461
480
  }
462
481
 
463
482
  interface AxiosInstance extends Axios {
464
- <T = any, R = AxiosResponse<T>, D = any>(config: RawAxiosRequestConfig<D>): Promise<R>;
465
- <T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
483
+ <T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
484
+ <T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
466
485
 
467
486
  defaults: Omit<AxiosDefaults, 'headers'> & {
468
487
  headers: HeadersDefaults & {
package/index.d.ts CHANGED
@@ -1,29 +1,23 @@
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
 
13
- type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
14
-
15
- type AxiosHeaderSetter = (value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher) => AxiosHeaders;
16
-
17
- type AxiosHeaderGetter = ((parser?: RegExp) => RegExpExecArray | null) |
18
- ((matcher?: AxiosHeaderMatcher) => AxiosHeaderValue);
8
+ type MethodsHeaders = Partial<{
9
+ [Key in Method as Lowercase<Key>]: AxiosHeaders;
10
+ } & {common: AxiosHeaders}>;
19
11
 
20
- type AxiosHeaderTester = (matcher?: AxiosHeaderMatcher) => boolean;
12
+ type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
21
13
 
22
14
  export class AxiosHeaders {
23
15
  constructor(
24
16
  headers?: RawAxiosHeaders | AxiosHeaders
25
17
  );
26
18
 
19
+ [key: string]: any;
20
+
27
21
  set(headerName?: string, value?: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
28
22
  set(headers?: RawAxiosHeaders | AxiosHeaders, rewrite?: boolean): AxiosHeaders;
29
23
 
@@ -38,7 +32,7 @@ export class AxiosHeaders {
38
32
 
39
33
  normalize(format: boolean): AxiosHeaders;
40
34
 
41
- concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string>): AxiosHeaders;
35
+ concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
42
36
 
43
37
  toJSON(asStrings?: boolean): RawAxiosHeaders;
44
38
 
@@ -46,49 +40,71 @@ export class AxiosHeaders {
46
40
 
47
41
  static accessor(header: string | string[]): AxiosHeaders;
48
42
 
49
- static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string>): AxiosHeaders;
43
+ static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
50
44
 
51
- setContentType: AxiosHeaderSetter;
52
- getContentType: AxiosHeaderGetter;
53
- hasContentType: AxiosHeaderTester;
45
+ setContentType(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
46
+ getContentType(parser?: RegExp): RegExpExecArray | null;
47
+ getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
48
+ hasContentType(matcher?: AxiosHeaderMatcher): boolean;
54
49
 
55
- setContentLength: AxiosHeaderSetter;
56
- getContentLength: AxiosHeaderGetter;
57
- hasContentLength: AxiosHeaderTester;
50
+ setContentLength(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
51
+ getContentLength(parser?: RegExp): RegExpExecArray | null;
52
+ getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
53
+ hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
58
54
 
59
- setAccept: AxiosHeaderSetter;
60
- getAccept: AxiosHeaderGetter;
61
- hasAccept: AxiosHeaderTester;
55
+ setAccept(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
56
+ getAccept(parser?: RegExp): RegExpExecArray | null;
57
+ getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
58
+ hasAccept(matcher?: AxiosHeaderMatcher): boolean;
62
59
 
63
- setUserAgent: AxiosHeaderSetter;
64
- getUserAgent: AxiosHeaderGetter;
65
- hasUserAgent: AxiosHeaderTester;
60
+ setUserAgent(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
61
+ getUserAgent(parser?: RegExp): RegExpExecArray | null;
62
+ getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
63
+ hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
66
64
 
67
- setContentEncoding: AxiosHeaderSetter;
68
- getContentEncoding: AxiosHeaderGetter;
69
- hasContentEncoding: AxiosHeaderTester;
65
+ setContentEncoding(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
66
+ getContentEncoding(parser?: RegExp): RegExpExecArray | null;
67
+ getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
68
+ hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
69
+
70
+ setAuthorization(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
71
+ getAuthorization(parser?: RegExp): RegExpExecArray | null;
72
+ getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
73
+ hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
74
+
75
+ [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
70
76
  }
71
77
 
72
- export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>;
78
+ type CommonRequestHeadersList = 'Accept' | 'Content-Type' | 'Content-Length' | 'User-Agent' | 'Content-Encoding' | 'Authorization';
79
+
80
+ export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
81
+ [Key in CommonRequestHeadersList]: AxiosHeaderValue;
82
+ }>;
73
83
 
74
84
  export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
75
85
 
76
- export type RawAxiosResponseHeaders = Partial<Record<string, string> & {
77
- "set-cookie"?: string[]
78
- }>;
86
+ type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
87
+
88
+ type RawCommonResponseHeaders = {
89
+ [Key in CommonResponseHeadersList]: AxiosHeaderValue;
90
+ } & {
91
+ "set-cookie": string[];
92
+ };
93
+
94
+ export type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
79
95
 
80
96
  export type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
81
97
 
82
98
  export interface AxiosRequestTransformer {
83
- (this: AxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
99
+ (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
84
100
  }
85
101
 
86
102
  export interface AxiosResponseTransformer {
87
- (this: AxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
103
+ (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
88
104
  }
89
105
 
90
106
  export interface AxiosAdapter {
91
- (config: AxiosRequestConfig): AxiosPromise;
107
+ (config: InternalAxiosRequestConfig): AxiosPromise;
92
108
  }
93
109
 
94
110
  export interface AxiosBasicCredentials {
@@ -283,13 +299,13 @@ type AxiosAdapterName = 'xhr' | 'http' | string;
283
299
 
284
300
  type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
285
301
 
286
- export interface RawAxiosRequestConfig<D = any> {
302
+ export interface AxiosRequestConfig<D = any> {
287
303
  url?: string;
288
304
  method?: Method | string;
289
305
  baseURL?: string;
290
306
  transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
291
307
  transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
292
- headers?: RawAxiosRequestHeaders | AxiosHeaders;
308
+ headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
293
309
  params?: any;
294
310
  paramsSerializer?: ParamsSerializerOptions;
295
311
  data?: D;
@@ -325,7 +341,10 @@ export interface RawAxiosRequestConfig<D = any> {
325
341
  formSerializer?: FormSerializerOptions;
326
342
  }
327
343
 
328
- export interface AxiosRequestConfig<D = any> extends RawAxiosRequestConfig {
344
+ // Alias
345
+ export type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
346
+
347
+ export interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
329
348
  headers: AxiosRequestHeaders;
330
349
  }
331
350
 
@@ -343,11 +362,11 @@ export interface HeadersDefaults {
343
362
  unlink?: RawAxiosRequestHeaders;
344
363
  }
345
364
 
346
- export interface AxiosDefaults<D = any> extends Omit<RawAxiosRequestConfig<D>, 'headers'> {
365
+ export interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
347
366
  headers: HeadersDefaults;
348
367
  }
349
368
 
350
- export interface CreateAxiosDefaults<D = any> extends Omit<RawAxiosRequestConfig<D>, 'headers'> {
369
+ export interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
351
370
  headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
352
371
  }
353
372
 
@@ -356,7 +375,7 @@ export interface AxiosResponse<T = any, D = any> {
356
375
  status: number;
357
376
  statusText: string;
358
377
  headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
359
- config: AxiosRequestConfig<D>;
378
+ config: InternalAxiosRequestConfig<D>;
360
379
  request?: any;
361
380
  }
362
381
 
@@ -364,12 +383,12 @@ export class AxiosError<T = unknown, D = any> extends Error {
364
383
  constructor(
365
384
  message?: string,
366
385
  code?: string,
367
- config?: AxiosRequestConfig<D>,
386
+ config?: InternalAxiosRequestConfig<D>,
368
387
  request?: any,
369
388
  response?: AxiosResponse<T, D>
370
389
  );
371
390
 
372
- config?: AxiosRequestConfig<D>;
391
+ config?: InternalAxiosRequestConfig<D>;
373
392
  code?: string;
374
393
  request?: any;
375
394
  response?: AxiosResponse<T, D>;
@@ -380,7 +399,7 @@ export class AxiosError<T = unknown, D = any> extends Error {
380
399
  static from<T = unknown, D = any>(
381
400
  error: Error | unknown,
382
401
  code?: string,
383
- config?: AxiosRequestConfig<D>,
402
+ config?: InternalAxiosRequestConfig<D>,
384
403
  request?: any,
385
404
  response?: AxiosResponse<T, D>,
386
405
  customProps?: object,
@@ -413,7 +432,7 @@ export interface Cancel {
413
432
  }
414
433
 
415
434
  export interface Canceler {
416
- (message?: string, config?: RawAxiosRequestConfig, request?: any): void;
435
+ (message?: string, config?: AxiosRequestConfig, request?: any): void;
417
436
  }
418
437
 
419
438
  export interface CancelTokenStatic {
@@ -434,7 +453,7 @@ export interface CancelTokenSource {
434
453
 
435
454
  export interface AxiosInterceptorOptions {
436
455
  synchronous?: boolean;
437
- runWhen?: (config: AxiosRequestConfig) => boolean;
456
+ runWhen?: (config: InternalAxiosRequestConfig) => boolean;
438
457
  }
439
458
 
440
459
  export interface AxiosInterceptorManager<V> {
@@ -444,29 +463,29 @@ export interface AxiosInterceptorManager<V> {
444
463
  }
445
464
 
446
465
  export class Axios {
447
- constructor(config?: RawAxiosRequestConfig);
466
+ constructor(config?: AxiosRequestConfig);
448
467
  defaults: AxiosDefaults;
449
468
  interceptors: {
450
- request: AxiosInterceptorManager<AxiosRequestConfig>;
469
+ request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
451
470
  response: AxiosInterceptorManager<AxiosResponse>;
452
471
  };
453
- getUri(config?: RawAxiosRequestConfig): string;
454
- request<T = any, R = AxiosResponse<T>, D = any>(config: RawAxiosRequestConfig<D>): Promise<R>;
455
- get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
456
- delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
457
- head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
458
- options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
459
- post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
460
- put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
461
- patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
462
- postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
463
- putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
464
- patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
472
+ getUri(config?: AxiosRequestConfig): string;
473
+ request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
474
+ get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
475
+ delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
476
+ head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
477
+ options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
478
+ post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
479
+ put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
480
+ patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
481
+ postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
482
+ putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
483
+ patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
465
484
  }
466
485
 
467
486
  export interface AxiosInstance extends Axios {
468
- <T = any, R = AxiosResponse<T>, D = any>(config: RawAxiosRequestConfig<D>): Promise<R>;
469
- <T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
487
+ <T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
488
+ <T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
470
489
 
471
490
  defaults: Omit<AxiosDefaults, 'headers'> & {
472
491
  headers: HeadersDefaults & {
package/lib/env/data.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.2.3";
1
+ export const VERSION = "1.2.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "exports": {
package/lib/.DS_Store DELETED
Binary file