axios 1.7.6 → 1.7.8
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/CHANGELOG.md +51 -0
- package/README.md +20 -8
- package/dist/axios.js +129 -129
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +67 -78
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +67 -78
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +73 -83
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +38 -29
- package/index.d.ts +75 -561
- package/lib/adapters/fetch.js +2 -2
- package/lib/adapters/http.js +5 -5
- package/lib/core/Axios.js +7 -2
- package/lib/core/mergeConfig.js +5 -5
- package/lib/env/data.js +1 -1
- package/lib/helpers/buildURL.js +7 -1
- package/lib/helpers/formDataToStream.js +2 -2
- package/lib/helpers/isURLSameOrigin.js +12 -65
- package/lib/helpers/trackStream.js +25 -5
- package/lib/helpers/validator.js +8 -0
- package/package.json +3 -3
package/index.d.cts
CHANGED
@@ -3,12 +3,12 @@ interface RawAxiosHeaders {
|
|
3
3
|
}
|
4
4
|
|
5
5
|
type MethodsHeaders = Partial<{
|
6
|
-
[Key in axios.Method as Lowercase<Key>]:
|
7
|
-
} & {common:
|
6
|
+
[Key in axios.Method as Lowercase<Key>]: InternalAxiosHeaders;
|
7
|
+
} & {common: InternalAxiosHeaders}>;
|
8
8
|
|
9
|
-
type AxiosHeaderMatcher = (this:
|
9
|
+
type AxiosHeaderMatcher = (this: InternalAxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
|
10
10
|
|
11
|
-
type AxiosHeaderParser = (this:
|
11
|
+
type AxiosHeaderParser = (this: InternalAxiosHeaders, value: axios.AxiosHeaderValue, header: string) => any;
|
12
12
|
|
13
13
|
type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent'| 'Content-Encoding' | 'Authorization';
|
14
14
|
|
@@ -16,15 +16,15 @@ type ContentType = axios.AxiosHeaderValue | 'text/html' | 'text/plain' | 'multip
|
|
16
16
|
|
17
17
|
type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
|
18
18
|
|
19
|
-
declare class
|
19
|
+
declare class InternalAxiosHeaders {
|
20
20
|
constructor(
|
21
|
-
headers?: RawAxiosHeaders |
|
21
|
+
headers?: RawAxiosHeaders | InternalAxiosHeaders | string
|
22
22
|
);
|
23
23
|
|
24
24
|
[key: string]: any;
|
25
25
|
|
26
|
-
set(headerName?: string, value?: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher):
|
27
|
-
set(headers?: RawAxiosHeaders |
|
26
|
+
set(headerName?: string, value?: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): InternalAxiosHeaders;
|
27
|
+
set(headers?: RawAxiosHeaders | InternalAxiosHeaders | string, rewrite?: boolean): InternalAxiosHeaders;
|
28
28
|
|
29
29
|
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
30
30
|
get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue;
|
@@ -35,44 +35,44 @@ declare class AxiosHeaders {
|
|
35
35
|
|
36
36
|
clear(matcher?: AxiosHeaderMatcher): boolean;
|
37
37
|
|
38
|
-
normalize(format: boolean):
|
38
|
+
normalize(format: boolean): InternalAxiosHeaders;
|
39
39
|
|
40
|
-
concat(...targets: Array<
|
40
|
+
concat(...targets: Array<InternalAxiosHeaders | RawAxiosHeaders | string | undefined | null>): InternalAxiosHeaders;
|
41
41
|
|
42
42
|
toJSON(asStrings?: boolean): RawAxiosHeaders;
|
43
43
|
|
44
|
-
static from(thing?:
|
44
|
+
static from(thing?: InternalAxiosHeaders | RawAxiosHeaders | string): InternalAxiosHeaders;
|
45
45
|
|
46
|
-
static accessor(header: string | string[]):
|
46
|
+
static accessor(header: string | string[]): InternalAxiosHeaders;
|
47
47
|
|
48
|
-
static concat(...targets: Array<
|
48
|
+
static concat(...targets: Array<InternalAxiosHeaders | RawAxiosHeaders | string | undefined | null>): InternalAxiosHeaders;
|
49
49
|
|
50
|
-
setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher):
|
50
|
+
setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): InternalAxiosHeaders;
|
51
51
|
getContentType(parser?: RegExp): RegExpExecArray | null;
|
52
52
|
getContentType(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
53
53
|
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
54
54
|
|
55
|
-
setContentLength(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher):
|
55
|
+
setContentLength(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): InternalAxiosHeaders;
|
56
56
|
getContentLength(parser?: RegExp): RegExpExecArray | null;
|
57
57
|
getContentLength(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
58
58
|
hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
|
59
59
|
|
60
|
-
setAccept(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher):
|
60
|
+
setAccept(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): InternalAxiosHeaders;
|
61
61
|
getAccept(parser?: RegExp): RegExpExecArray | null;
|
62
62
|
getAccept(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
63
63
|
hasAccept(matcher?: AxiosHeaderMatcher): boolean;
|
64
64
|
|
65
|
-
setUserAgent(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher):
|
65
|
+
setUserAgent(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): InternalAxiosHeaders;
|
66
66
|
getUserAgent(parser?: RegExp): RegExpExecArray | null;
|
67
67
|
getUserAgent(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
68
68
|
hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
|
69
69
|
|
70
|
-
setContentEncoding(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher):
|
70
|
+
setContentEncoding(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): InternalAxiosHeaders;
|
71
71
|
getContentEncoding(parser?: RegExp): RegExpExecArray | null;
|
72
72
|
getContentEncoding(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
73
73
|
hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
|
74
74
|
|
75
|
-
setAuthorization(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher):
|
75
|
+
setAuthorization(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): InternalAxiosHeaders;
|
76
76
|
getAuthorization(parser?: RegExp): RegExpExecArray | null;
|
77
77
|
getAuthorization(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
78
78
|
hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
|
@@ -111,10 +111,10 @@ declare class AxiosError<T = unknown, D = any> extends Error {
|
|
111
111
|
static readonly ETIMEDOUT = "ETIMEDOUT";
|
112
112
|
}
|
113
113
|
|
114
|
-
declare class
|
114
|
+
declare class InternalCanceledError<T> extends AxiosError<T> {
|
115
115
|
}
|
116
116
|
|
117
|
-
declare class
|
117
|
+
declare class InternalAxios {
|
118
118
|
constructor(config?: axios.AxiosRequestConfig);
|
119
119
|
defaults: axios.AxiosDefaults;
|
120
120
|
interceptors: {
|
@@ -135,7 +135,7 @@ declare class Axios {
|
|
135
135
|
patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
136
136
|
}
|
137
137
|
|
138
|
-
declare enum
|
138
|
+
declare enum InternalHttpStatusCode {
|
139
139
|
Continue = 100,
|
140
140
|
SwitchingProtocols = 101,
|
141
141
|
Processing = 102,
|
@@ -205,6 +205,10 @@ type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
|
|
205
205
|
|
206
206
|
declare namespace axios {
|
207
207
|
type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
|
208
|
+
type Axios = InternalAxios;
|
209
|
+
type AxiosHeaders = InternalAxiosHeaders;
|
210
|
+
type CanceledError<T> = InternalCanceledError<T>;
|
211
|
+
type HttpStatusCode = InternalHttpStatusCode;
|
208
212
|
|
209
213
|
type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
210
214
|
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
@@ -398,7 +402,7 @@ declare namespace axios {
|
|
398
402
|
maxBodyLength?: number;
|
399
403
|
maxRedirects?: number;
|
400
404
|
maxRate?: number | [MaxUploadRate, MaxDownloadRate];
|
401
|
-
beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode:
|
405
|
+
beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode: InternalHttpStatusCode}) => void;
|
402
406
|
socketPath?: string | null;
|
403
407
|
transport?: any;
|
404
408
|
httpAgent?: any;
|
@@ -493,13 +497,17 @@ declare namespace axios {
|
|
493
497
|
runWhen?: (config: InternalAxiosRequestConfig) => boolean;
|
494
498
|
}
|
495
499
|
|
500
|
+
type AxiosRequestInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions) => number;
|
501
|
+
|
502
|
+
type AxiosResponseInterceptorUse<T> = (onFulfilled?: ((value: T) => T | Promise<T>) | null, onRejected?: ((error: any) => any) | null) => number;
|
503
|
+
|
496
504
|
interface AxiosInterceptorManager<V> {
|
497
|
-
use
|
505
|
+
use: V extends AxiosResponse ? AxiosResponseInterceptorUse<V> : AxiosRequestInterceptorUse<V>;
|
498
506
|
eject(id: number): void;
|
499
507
|
clear(): void;
|
500
508
|
}
|
501
509
|
|
502
|
-
interface AxiosInstance extends
|
510
|
+
interface AxiosInstance extends InternalAxios {
|
503
511
|
<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
504
512
|
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
505
513
|
|
@@ -521,13 +529,14 @@ declare namespace axios {
|
|
521
529
|
}
|
522
530
|
|
523
531
|
interface AxiosStatic extends AxiosInstance {
|
532
|
+
default: AxiosStatic;
|
524
533
|
create(config?: CreateAxiosDefaults): AxiosInstance;
|
525
534
|
Cancel: CancelStatic;
|
526
535
|
CancelToken: CancelTokenStatic;
|
527
|
-
Axios: typeof
|
536
|
+
Axios: typeof InternalAxios;
|
528
537
|
AxiosError: typeof AxiosError;
|
529
|
-
CanceledError: typeof
|
530
|
-
HttpStatusCode: typeof
|
538
|
+
CanceledError: typeof InternalCanceledError;
|
539
|
+
HttpStatusCode: typeof InternalHttpStatusCode;
|
531
540
|
readonly VERSION: string;
|
532
541
|
isCancel(value: any): value is Cancel;
|
533
542
|
all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
@@ -536,7 +545,7 @@ declare namespace axios {
|
|
536
545
|
toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;
|
537
546
|
formToJSON(form: GenericFormData|GenericHTMLFormElement): object;
|
538
547
|
getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter;
|
539
|
-
AxiosHeaders: typeof
|
548
|
+
AxiosHeaders: typeof InternalAxiosHeaders;
|
540
549
|
}
|
541
550
|
}
|
542
551
|
|