axios 1.2.0 → 1.2.1
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 +31 -0
- package/README.md +2 -3
- package/dist/axios.js +21 -4
- 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 +28 -6
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +37 -14
- 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 +25 -14
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +3 -0
- package/index.d.ts +13 -3
- package/index.js +4 -2
- package/lib/adapters/http.js +16 -8
- package/lib/adapters/xhr.js +2 -2
- package/lib/axios.js +3 -0
- package/lib/core/dispatchRequest.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/speedometer.js +1 -1
- package/lib/platform/browser/index.js +19 -0
- package/package.json +1 -1
package/dist/browser/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.2.
|
1
|
+
// Axios v1.2.1 Copyright (c) 2022 Matt Zabriskie and contributors
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
function bind(fn, thisArg) {
|
@@ -1219,6 +1219,24 @@ const isStandardBrowserEnv = (() => {
|
|
1219
1219
|
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
1220
1220
|
})();
|
1221
1221
|
|
1222
|
+
/**
|
1223
|
+
* Determine if we're running in a standard browser webWorker environment
|
1224
|
+
*
|
1225
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
1226
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
1227
|
+
* filtered out due to its judgment standard
|
1228
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
1229
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
1230
|
+
*/
|
1231
|
+
const isStandardBrowserWebWorkerEnv = (() => {
|
1232
|
+
return (
|
1233
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
1234
|
+
self instanceof WorkerGlobalScope &&
|
1235
|
+
typeof self.importScripts === 'function'
|
1236
|
+
);
|
1237
|
+
})();
|
1238
|
+
|
1239
|
+
|
1222
1240
|
var platform = {
|
1223
1241
|
isBrowser: true,
|
1224
1242
|
classes: {
|
@@ -1227,6 +1245,7 @@ var platform = {
|
|
1227
1245
|
Blob
|
1228
1246
|
},
|
1229
1247
|
isStandardBrowserEnv,
|
1248
|
+
isStandardBrowserWebWorkerEnv,
|
1230
1249
|
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
1231
1250
|
};
|
1232
1251
|
|
@@ -2091,7 +2110,7 @@ function speedometer(samplesCount, min) {
|
|
2091
2110
|
|
2092
2111
|
const passed = startedAt && now - startedAt;
|
2093
2112
|
|
2094
|
-
return
|
2113
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
2095
2114
|
};
|
2096
2115
|
}
|
2097
2116
|
|
@@ -2142,7 +2161,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2142
2161
|
}
|
2143
2162
|
}
|
2144
2163
|
|
2145
|
-
if (utils.isFormData(requestData) && platform.isStandardBrowserEnv) {
|
2164
|
+
if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
|
2146
2165
|
requestHeaders.setContentType(false); // Let the browser set it
|
2147
2166
|
}
|
2148
2167
|
|
@@ -2170,7 +2189,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2170
2189
|
const responseHeaders = AxiosHeaders$1.from(
|
2171
2190
|
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
2172
2191
|
);
|
2173
|
-
const responseData = !responseType || responseType === 'text' ||
|
2192
|
+
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
2174
2193
|
request.responseText : request.response;
|
2175
2194
|
const response = {
|
2176
2195
|
data: responseData,
|
@@ -2397,7 +2416,7 @@ function throwIfCancellationRequested(config) {
|
|
2397
2416
|
}
|
2398
2417
|
|
2399
2418
|
if (config.signal && config.signal.aborted) {
|
2400
|
-
throw new CanceledError();
|
2419
|
+
throw new CanceledError(null, config);
|
2401
2420
|
}
|
2402
2421
|
}
|
2403
2422
|
|
@@ -2558,7 +2577,7 @@ function mergeConfig(config1, config2) {
|
|
2558
2577
|
return config;
|
2559
2578
|
}
|
2560
2579
|
|
2561
|
-
const VERSION = "1.2.
|
2580
|
+
const VERSION = "1.2.1";
|
2562
2581
|
|
2563
2582
|
const validators$1 = {};
|
2564
2583
|
|
@@ -3044,6 +3063,9 @@ axios.spread = spread;
|
|
3044
3063
|
// Expose isAxiosError
|
3045
3064
|
axios.isAxiosError = isAxiosError;
|
3046
3065
|
|
3066
|
+
// Expose mergeConfig
|
3067
|
+
axios.mergeConfig = mergeConfig;
|
3068
|
+
|
3047
3069
|
axios.AxiosHeaders = AxiosHeaders$1;
|
3048
3070
|
|
3049
3071
|
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|