axios 1.3.3 → 1.3.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/CHANGELOG.md +26 -0
- package/README.md +3 -0
- package/dist/axios.js +19 -11
- 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 +17 -11
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +17 -11
- 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 +48 -36
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +1 -1
- package/index.d.ts +1 -1
- package/lib/adapters/http.js +33 -25
- package/lib/core/Axios.js +11 -5
- package/lib/core/AxiosHeaders.js +1 -3
- package/lib/env/data.js +1 -1
- package/lib/platform/browser/classes/Blob.js +3 -0
- package/lib/platform/browser/index.js +1 -0
- package/package.json +1 -1
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;
|
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;
|
package/lib/adapters/http.js
CHANGED
@@ -116,15 +116,39 @@ function setProxy(options, configProxy, location) {
|
|
116
116
|
|
117
117
|
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
118
118
|
|
119
|
+
// temporary hotfix
|
120
|
+
|
121
|
+
const wrapAsync = (asyncExecutor) => {
|
122
|
+
return new Promise((resolve, reject) => {
|
123
|
+
let onDone;
|
124
|
+
let isDone;
|
125
|
+
|
126
|
+
const done = (value, isRejected) => {
|
127
|
+
if (isDone) return;
|
128
|
+
isDone = true;
|
129
|
+
onDone && onDone(value, isRejected);
|
130
|
+
}
|
131
|
+
|
132
|
+
const _resolve = (value) => {
|
133
|
+
done(value);
|
134
|
+
resolve(value);
|
135
|
+
};
|
136
|
+
|
137
|
+
const _reject = (reason) => {
|
138
|
+
done(reason, true);
|
139
|
+
reject(reason);
|
140
|
+
}
|
141
|
+
|
142
|
+
asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
|
143
|
+
})
|
144
|
+
};
|
145
|
+
|
119
146
|
/*eslint consistent-return:0*/
|
120
147
|
export default isHttpAdapterSupported && function httpAdapter(config) {
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
const responseType = config.responseType;
|
125
|
-
const responseEncoding = config.responseEncoding;
|
148
|
+
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
149
|
+
let {data} = config;
|
150
|
+
const {responseType, responseEncoding} = config;
|
126
151
|
const method = config.method.toUpperCase();
|
127
|
-
let isFinished;
|
128
152
|
let isDone;
|
129
153
|
let rejected = false;
|
130
154
|
let req;
|
@@ -132,10 +156,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
132
156
|
// temporary internal emitter until the AxiosRequest class will be implemented
|
133
157
|
const emitter = new EventEmitter();
|
134
158
|
|
135
|
-
|
136
|
-
if (isFinished) return;
|
137
|
-
isFinished = true;
|
138
|
-
|
159
|
+
const onFinished = () => {
|
139
160
|
if (config.cancelToken) {
|
140
161
|
config.cancelToken.unsubscribe(abort);
|
141
162
|
}
|
@@ -147,26 +168,13 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
147
168
|
emitter.removeAllListeners();
|
148
169
|
}
|
149
170
|
|
150
|
-
|
151
|
-
if (isDone) return;
|
152
|
-
|
171
|
+
onDone((value, isRejected) => {
|
153
172
|
isDone = true;
|
154
|
-
|
155
173
|
if (isRejected) {
|
156
174
|
rejected = true;
|
157
175
|
onFinished();
|
158
176
|
}
|
159
|
-
|
160
|
-
isRejected ? rejectPromise(value) : resolvePromise(value);
|
161
|
-
}
|
162
|
-
|
163
|
-
const resolve = function resolve(value) {
|
164
|
-
done(value);
|
165
|
-
};
|
166
|
-
|
167
|
-
const reject = function reject(value) {
|
168
|
-
done(value, true);
|
169
|
-
};
|
177
|
+
});
|
170
178
|
|
171
179
|
function abort(reason) {
|
172
180
|
emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
package/lib/core/Axios.js
CHANGED
@@ -57,11 +57,17 @@ class Axios {
|
|
57
57
|
}, false);
|
58
58
|
}
|
59
59
|
|
60
|
-
if (paramsSerializer
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
package/lib/core/AxiosHeaders.js
CHANGED
@@ -29,9 +29,7 @@ function parseTokens(str) {
|
|
29
29
|
return tokens;
|
30
30
|
}
|
31
31
|
|
32
|
-
|
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.
|
1
|
+
export const VERSION = "1.3.5";
|