mirror of
https://github.com/tenrok/axios.git
synced 2026-06-05 16:42:32 +03:00
chore: release 1.2.1
This commit is contained in:
Vendored
+25
-14
@@ -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);
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user