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
+37 -14
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 bind(fn, thisArg) {
return function wrap() {
return fn.apply(thisArg, arguments);
@@ -1217,6 +1217,24 @@ const isStandardBrowserEnv = (() => {
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
*/
const isStandardBrowserWebWorkerEnv = (() => {
return (
typeof WorkerGlobalScope !== 'undefined' &&
self instanceof WorkerGlobalScope &&
typeof self.importScripts === 'function'
);
})();
const platform = {
isBrowser: true,
classes: {
@@ -1225,6 +1243,7 @@ const platform = {
Blob
},
isStandardBrowserEnv,
isStandardBrowserWebWorkerEnv,
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
};
@@ -2089,7 +2108,7 @@ function speedometer(samplesCount, min) {
const passed = startedAt && now - startedAt;
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
};
}
@@ -2140,7 +2159,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
}
}
if (utils.isFormData(requestData) && platform.isStandardBrowserEnv) {
if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
requestHeaders.setContentType(false); // Let the browser set it
}
@@ -2168,7 +2187,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
const responseHeaders = AxiosHeaders$2.from(
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
);
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
request.responseText : request.response;
const response = {
data: responseData,
@@ -2395,7 +2414,7 @@ function throwIfCancellationRequested(config) {
}
if (config.signal && config.signal.aborted) {
throw new CanceledError$1();
throw new CanceledError$1(null, config);
}
}
@@ -2466,7 +2485,7 @@ const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? thing.toJSO
*
* @returns {Object} New object resulting from merging config2 to config1
*/
function mergeConfig(config1, config2) {
function mergeConfig$1(config1, config2) {
// eslint-disable-next-line no-param-reassign
config2 = config2 || {};
const config = {};
@@ -2556,7 +2575,7 @@ function mergeConfig(config1, config2) {
return config;
}
const VERSION$1 = "1.2.0";
const VERSION$1 = "1.2.1";
const validators$1 = {};
@@ -2681,7 +2700,7 @@ class Axios$1 {
config = configOrUrl || {};
}
config = mergeConfig(this.defaults, config);
config = mergeConfig$1(this.defaults, config);
const {transitional, paramsSerializer, headers} = config;
@@ -2791,7 +2810,7 @@ class Axios$1 {
}
getUri(config) {
config = mergeConfig(this.defaults, config);
config = mergeConfig$1(this.defaults, config);
const fullPath = buildFullPath(config.baseURL, config.url);
return buildURL(fullPath, config.params, config.paramsSerializer);
}
@@ -2801,7 +2820,7 @@ class Axios$1 {
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Axios$1.prototype[method] = function(url, config) {
return this.request(mergeConfig(config || {}, {
return this.request(mergeConfig$1(config || {}, {
method,
url,
data: (config || {}).data
@@ -2814,7 +2833,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
function generateHTTPMethod(isForm) {
return function httpMethod(url, data, config) {
return this.request(mergeConfig(config || {}, {
return this.request(mergeConfig$1(config || {}, {
method,
headers: isForm ? {
'Content-Type': 'multipart/form-data'
@@ -3007,7 +3026,7 @@ function createInstance(defaultConfig) {
// Factory for creating new instances
instance.create = function create(instanceConfig) {
return createInstance(mergeConfig(defaultConfig, instanceConfig));
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
};
return instance;
@@ -3042,6 +3061,9 @@ axios.spread = spread$1;
// Expose isAxiosError
axios.isAxiosError = isAxiosError$1;
// Expose mergeConfig
axios.mergeConfig = mergeConfig$1;
axios.AxiosHeaders = AxiosHeaders$2;
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
@@ -3067,8 +3089,9 @@ const {
spread,
toFormData,
AxiosHeaders,
formToJSON
formToJSON,
mergeConfig
} = axios$1;
export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, VERSION, all, axios$1 as default, formToJSON, isAxiosError, isCancel, spread, toFormData };
export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, VERSION, all, axios$1 as default, formToJSON, isAxiosError, isCancel, mergeConfig, spread, toFormData };
//# sourceMappingURL=axios.js.map
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long