2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-14 18:42:33 +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
+24 -20
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';
function bind(fn, thisArg) {
@@ -545,8 +545,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;
}
});
@@ -1388,10 +1389,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
@@ -1421,7 +1418,7 @@ const defaults = {
transitional: transitionalDefaults,
adapter: ['xhr', 'http'],
adapter: platform.isNode ? 'http' : 'xhr',
transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || '';
@@ -1530,19 +1527,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);
});
var defaults$1 = defaults;
// RawAxiosHeaders whose duplicates are ignored by node
@@ -1876,7 +1870,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);
var AxiosHeaders$1 = AxiosHeaders;
@@ -2631,7 +2635,7 @@ function mergeConfig(config1, config2) {
return config;
}
const VERSION = "1.4.0";
const VERSION = "1.5.0";
const validators$1 = {};
@@ -2784,15 +2788,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];
@@ -3202,6 +3204,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