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

chore: release 1.1.3

This commit is contained in:
Jay
2022-10-15 15:43:01 +02:00
parent b0ebf9fcac
commit 9bd53214f6
15 changed files with 657 additions and 830 deletions
+40 -31
View File
@@ -1,4 +1,4 @@
// Axios v1.1.2 Copyright (c) 2022 Matt Zabriskie and contributors
// Axios v1.1.3 Copyright (c) 2022 Matt Zabriskie and contributors
'use strict';
const FormData$1 = require('form-data');
@@ -897,7 +897,7 @@ function toFormData(obj, formData, options) {
key = removeBrackets(key);
arr.forEach(function each(el, index) {
!utils.isUndefined(el) && formData.append(
!(utils.isUndefined(el) || el === null) && formData.append(
// eslint-disable-next-line no-nested-ternary
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
convertValue(el)
@@ -934,7 +934,7 @@ function toFormData(obj, formData, options) {
stack.push(value);
utils.forEach(value, function each(el, key) {
const result = !utils.isUndefined(el) && visitor.call(
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
);
@@ -1040,21 +1040,28 @@ function buildURL(url, params, options) {
if (!params) {
return url;
}
const hashmarkIndex = url.indexOf('#');
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
const _encode = options && options.encode || encode;
const serializerParams = utils.isURLSearchParams(params) ?
params.toString() :
new AxiosURLSearchParams(params, options).toString(_encode);
const serializeFn = options && options.serialize;
if (serializerParams) {
url += (url.indexOf('?') === -1 ? '?' : '&') + serializerParams;
let serializedParams;
if (serializeFn) {
serializedParams = serializeFn(params, options);
} else {
serializedParams = utils.isURLSearchParams(params) ?
params.toString() :
new AxiosURLSearchParams(params, options).toString(_encode);
}
if (serializedParams) {
const hashmarkIndex = url.indexOf("#");
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
}
return url;
@@ -1313,7 +1320,7 @@ function buildFullPath(baseURL, requestedURL) {
return requestedURL;
}
const VERSION = "1.1.2";
const VERSION = "1.1.3";
/**
* A `CanceledError` is an object that is thrown when an operation is canceled.
@@ -1451,7 +1458,7 @@ function normalizeValue(value) {
return value;
}
return String(value);
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
}
function parseTokens(str) {
@@ -1538,13 +1545,7 @@ Object.assign(AxiosHeaders.prototype, {
return;
}
if (utils.isArray(_value)) {
_value = _value.map(normalizeValue);
} else {
_value = normalizeValue(_value);
}
self[key || _header] = _value;
self[key || _header] = normalizeValue(_value);
}
if (utils.isPlainObject(header)) {
@@ -1658,13 +1659,13 @@ Object.assign(AxiosHeaders.prototype, {
return this;
},
toJSON: function() {
toJSON: function(asStrings) {
const obj = Object.create(null);
utils.forEach(Object.assign({}, this[$defaults] || null, this),
(value, header) => {
if (value == null || value === false) return;
obj[header] = utils.isArray(value) ? value.join(', ') : value;
obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value;
});
return obj;
@@ -2003,7 +2004,7 @@ function dispatchBeforeRedirect(options) {
* If the proxy or config afterRedirects functions are defined, call them with the options
*
* @param {http.ClientRequestArgs} options
* @param {AxiosProxyConfig} configProxy
* @param {AxiosProxyConfig} configProxy configuration from Axios options object
* @param {string} location
*
* @returns {http.ClientRequestArgs}
@@ -2034,13 +2035,14 @@ function setProxy(options, configProxy, location) {
}
options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
options.hostname = proxy.hostname;
const proxyHost = proxy.hostname || proxy.host;
options.hostname = proxyHost;
// Replace 'host' since options is not a URL object
options.host = proxy.hostname;
options.host = proxyHost;
options.port = proxy.port;
options.path = location;
if (proxy.protocol) {
options.protocol = proxy.protocol;
options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`;
}
}
@@ -3401,7 +3403,7 @@ class Axios {
config = mergeConfig(this.defaults, config);
const transitional = config.transitional;
const {transitional, paramsSerializer} = config;
if (transitional !== undefined) {
validator.assertOptions(transitional, {
@@ -3411,6 +3413,13 @@ class Axios {
}, false);
}
if (paramsSerializer !== undefined) {
validator.assertOptions(paramsSerializer, {
encode: validators.function,
serialize: validators.function
}, true);
}
// Set config.method
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
+1 -1
View File
File diff suppressed because one or more lines are too long