2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

chore: release 1.2.1

This commit is contained in:
Jay
2022-12-05 21:36:02 +02:00
parent a6efeaf2d9
commit 1fd79d3220
17 changed files with 155 additions and 51 deletions
+21 -4
View File
@@ -1,4 +1,4 @@
// Axios v1.2.0 Copyright (c) 2022 Matt Zabriskie and contributors
// Axios v1.2.1 Copyright (c) 2022 Matt Zabriskie and contributors
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
@@ -1212,6 +1212,19 @@
}
return typeof window !== 'undefined' && typeof document !== 'undefined';
}();
/**
* Determine if we're running in a standard browser webWorker environment
*
* Although the `isStandardBrowserEnv` method indicates that
* `allows axios to run in a web worker`, the WebWorker will still be
* filtered out due to its judgment standard
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
* This leads to a problem when axios post `FormData` in webWorker
*/
var isStandardBrowserWebWorkerEnv = function () {
return typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
}();
var platform = {
isBrowser: true,
classes: {
@@ -1220,6 +1233,7 @@
Blob: Blob
},
isStandardBrowserEnv: isStandardBrowserEnv,
isStandardBrowserWebWorkerEnv: isStandardBrowserWebWorkerEnv,
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
};
@@ -2008,7 +2022,7 @@
config.signal.removeEventListener('abort', onCanceled);
}
}
if (utils.isFormData(requestData) && platform.isStandardBrowserEnv) {
if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
requestHeaders.setContentType(false); // Let the browser set it
}
@@ -2232,7 +2246,7 @@
config.cancelToken.throwIfRequested();
}
if (config.signal && config.signal.aborted) {
throw new CanceledError();
throw new CanceledError(null, config);
}
}
@@ -2377,7 +2391,7 @@
return config;
}
var VERSION = "1.2.0";
var VERSION = "1.2.1";
var validators$1 = {};
@@ -2824,6 +2838,9 @@
// Expose isAxiosError
axios.isAxiosError = isAxiosError;
// Expose mergeConfig
axios.mergeConfig = mergeConfig;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = function (thing) {
return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);