2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00

chore(release): v1.5.0 (#5838)

Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2023-08-26 22:10:04 +03:00
committed by GitHub
parent 1601f4a27a
commit 6365751ba6
17 changed files with 140 additions and 94 deletions
+27 -21
View File
@@ -1,4 +1,4 @@
// Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors
// Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
'use strict';
const FormData$1 = require('form-data');
@@ -568,8 +568,9 @@ const reduceDescriptors = (obj, reducer) => {
const reducedDescriptors = {};
forEach(descriptors, (descriptor, name) => {
if (reducer(descriptor, name, obj) !== false) {
reducedDescriptors[name] = descriptor;
let ret;
if ((ret = reducer(descriptor, name, obj)) !== false) {
reducedDescriptors[name] = ret || descriptor;
}
});
@@ -1353,10 +1354,6 @@ function formDataToJSON(formData) {
return null;
}
const DEFAULT_CONTENT_TYPE = {
'Content-Type': undefined
};
/**
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
* of the input
@@ -1386,7 +1383,7 @@ const defaults = {
transitional: transitionalDefaults,
adapter: ['xhr', 'http'],
adapter: 'http' ,
transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || '';
@@ -1495,19 +1492,16 @@ const defaults = {
headers: {
common: {
'Accept': 'application/json, text/plain, */*'
'Accept': 'application/json, text/plain, */*',
'Content-Type': undefined
}
}
};
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
defaults.headers[method] = {};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
});
const defaults$1 = defaults;
// RawAxiosHeaders whose duplicates are ignored by node
@@ -1841,7 +1835,17 @@ class AxiosHeaders {
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
utils.freezeMethods(AxiosHeaders.prototype);
// reserved names hotfix
utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
return {
get: () => value,
set(headerValue) {
this[mapped] = headerValue;
}
}
});
utils.freezeMethods(AxiosHeaders);
const AxiosHeaders$1 = AxiosHeaders;
@@ -1961,7 +1965,7 @@ function buildFullPath(baseURL, requestedURL) {
return requestedURL;
}
const VERSION = "1.4.0";
const VERSION = "1.5.0";
function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -2810,11 +2814,13 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
auth,
protocol,
family,
lookup,
beforeRedirect: dispatchBeforeRedirect,
beforeRedirects: {}
};
// cacheable-lookup integration hotfix
!utils.isUndefined(lookup) && (options.lookup = lookup);
if (config.socketPath) {
options.socketPath = config.socketPath;
} else {
@@ -3811,15 +3817,13 @@ class Axios {
// Set config.method
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
let contextHeaders;
// Flatten headers
contextHeaders = headers && utils.merge(
let contextHeaders = headers && utils.merge(
headers.common,
headers[config.method]
);
contextHeaders && utils.forEach(
headers && utils.forEach(
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
(method) => {
delete headers[method];
@@ -4229,6 +4233,8 @@ axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.getAdapter = adapters.getAdapter;
axios.HttpStatusCode = HttpStatusCode$1;
axios.default = axios;
+1 -1
View File
File diff suppressed because one or more lines are too long