2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-24 14:04:14 +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
+31
View File
@@ -1,5 +1,36 @@
# Changelog
## [1.2.1] - 2022-12-05
### Changed
- feat(exports): export mergeConfig [#5151](https://github.com/axios/axios/pull/5151)
### Fixed
- fix(CancelledError): include config [#4922](https://github.com/axios/axios/pull/4922)
- fix(general): removing multiple/trailing/leading whitespace [#5022](https://github.com/axios/axios/pull/5022)
- fix(headers): decompression for responses without Content-Length header [#5306](https://github.com/axios/axios/pull/5306)
- fix(webWorker): exception to sending form data in web worker [#5139](https://github.com/axios/axios/pull/5139)
### Refactors
- refactor(types): AxiosProgressEvent.event type to any [#5308](https://github.com/axios/axios/pull/5308)
- refactor(types): add missing types for static AxiosError.from method [#4956](https://github.com/axios/axios/pull/4956)
### Chores
- chore(docs): remove README link to non-existent upgrade guide [#5307](https://github.com/axios/axios/pull/5307)
- chore(docs): typo in issue template name [#5159](https://github.com/axios/axios/pull/5159)
### Contributors to this release
- [](https://github.com/DigitalBrainJS)
- [](https://github.com/zachlysobey)
- [](https://github.com/kevincennis)
- [](https://github.com/phloose)
- [](https://github.com/secondl1ght)
- [](https://github.com/0x30)
- [](https://github.com/ovarn)
- [](https://github.com/arthurfiorette)
- [](https://github.com/0x30)
## [1.2.0] - 2022-11-10
### Changed
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "axios",
"main": "./dist/axios.js",
"version": "1.2.0",
"version": "1.2.1",
"homepage": "https://axios-http.com",
"authors": [
"Matt Zabriskie"
+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);
+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
+28 -6
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
'use strict';
function bind(fn, thisArg) {
@@ -1219,6 +1219,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'
);
})();
var platform = {
isBrowser: true,
classes: {
@@ -1227,6 +1245,7 @@ var platform = {
Blob
},
isStandardBrowserEnv,
isStandardBrowserWebWorkerEnv,
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
};
@@ -2091,7 +2110,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;
};
}
@@ -2142,7 +2161,7 @@ var 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
}
@@ -2170,7 +2189,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
const responseHeaders = AxiosHeaders$1.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,
@@ -2397,7 +2416,7 @@ function throwIfCancellationRequested(config) {
}
if (config.signal && config.signal.aborted) {
throw new CanceledError();
throw new CanceledError(null, config);
}
}
@@ -2558,7 +2577,7 @@ function mergeConfig(config1, config2) {
return config;
}
const VERSION = "1.2.0";
const VERSION = "1.2.1";
const validators$1 = {};
@@ -3044,6 +3063,9 @@ axios.spread = spread;
// Expose isAxiosError
axios.isAxiosError = isAxiosError;
// Expose mergeConfig
axios.mergeConfig = mergeConfig;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
+1 -1
View File
File diff suppressed because one or more lines are too long
+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
+25 -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
'use strict';
const FormData$1 = require('form-data');
@@ -1907,7 +1907,7 @@ function buildFullPath(baseURL, requestedURL) {
return requestedURL;
}
const VERSION = "1.2.0";
const VERSION = "1.2.1";
function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -2040,7 +2040,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;
};
}
@@ -2229,6 +2229,11 @@ class AxiosTransformStream extends stream__default["default"].Transform{
const AxiosTransformStream$1 = AxiosTransformStream;
const zlibOptions = {
flush: zlib__default["default"].constants.Z_SYNC_FLUSH,
finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH
};
const isBrotliSupported = utils.isFunction(zlib__default["default"].createBrotliDecompress);
const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"];
@@ -2469,7 +2474,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
}
}
const contentLength = +headers.getContentLength();
const contentLength = utils.toFiniteNumber(headers.getContentLength());
if (utils.isArray(maxRate)) {
maxUploadRate = maxRate[0];
@@ -2484,7 +2489,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
}
data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({
length: utils.toFiniteNumber(contentLength),
length: contentLength,
maxRate: utils.toFiniteNumber(maxUploadRate)
})], utils.noop);
@@ -2527,7 +2532,10 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
return reject(customErr);
}
headers.set('Accept-Encoding', 'gzip, deflate, br', false);
headers.set(
'Accept-Encoding',
'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false
);
const options = {
path,
@@ -2599,17 +2607,17 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
streams.push(transformStream);
}
// uncompress the response body transparently if required
// decompress the response body transparently if required
let responseStream = res;
// return the last request in case of redirects
const lastRequest = res.req || req;
// if decompress disabled we should not decompress
if (config.decompress !== false) {
if (config.decompress !== false && res.headers['content-encoding']) {
// if no content, but headers still say that it is encoded,
// remove the header not confuse downstream operations
if ((!responseLength || res.statusCode === 204) && res.headers['content-encoding']) {
if (method === 'HEAD' || res.statusCode === 204) {
delete res.headers['content-encoding'];
}
@@ -2619,14 +2627,14 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
case 'compress':
case 'deflate':
// add the unzipper to the body stream processing pipeline
streams.push(zlib__default["default"].createUnzip());
streams.push(zlib__default["default"].createUnzip(zlibOptions));
// remove the content-encoding in order to not confuse downstream operations
delete res.headers['content-encoding'];
break;
case 'br':
if (isBrotliSupported) {
streams.push(zlib__default["default"].createBrotliDecompress());
streams.push(zlib__default["default"].createBrotliDecompress(zlibOptions));
delete res.headers['content-encoding'];
}
}
@@ -2955,7 +2963,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
}
@@ -2983,7 +2991,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
const responseHeaders = AxiosHeaders$1.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,
@@ -3210,7 +3218,7 @@ function throwIfCancellationRequested(config) {
}
if (config.signal && config.signal.aborted) {
throw new CanceledError();
throw new CanceledError(null, config);
}
}
@@ -3855,6 +3863,9 @@ axios.spread = spread;
// Expose isAxiosError
axios.isAxiosError = isAxiosError;
// Expose mergeConfig
axios.mergeConfig = mergeConfig;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
export const VERSION = "1.2.0";
export const VERSION = "1.2.1";
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "axios",
"version": "1.2.0",
"version": "1.2.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "axios",
"version": "1.2.0",
"version": "1.2.1",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "axios",
"version": "1.2.0",
"version": "1.2.1",
"description": "Promise based HTTP client for the browser and node.js",
"main": "index.js",
"exports": {