mirror of
https://github.com/tenrok/axios.git
synced 2026-06-11 18:02:32 +03:00
chore(release): v1.3.0 (#5513)
Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9263473154
commit
7fbfbbeff6
Vendored
+55
-25
@@ -1,4 +1,4 @@
|
||||
// Axios v1.2.6 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||
// Axios v1.3.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||
'use strict';
|
||||
|
||||
function bind(fn, thisArg) {
|
||||
@@ -517,7 +517,7 @@ const matchAll = (regExp, str) => {
|
||||
const isHTMLForm = kindOfTest('HTMLFormElement');
|
||||
|
||||
const toCamelCase = str => {
|
||||
return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,
|
||||
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
||||
function replacer(m, p1, p2) {
|
||||
return p1.toUpperCase() + p2;
|
||||
}
|
||||
@@ -601,6 +601,37 @@ const toFiniteNumber = (value, defaultValue) => {
|
||||
return Number.isFinite(value) ? value : defaultValue;
|
||||
};
|
||||
|
||||
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
||||
|
||||
const DIGIT = '0123456789';
|
||||
|
||||
const ALPHABET = {
|
||||
DIGIT,
|
||||
ALPHA,
|
||||
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
||||
};
|
||||
|
||||
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
||||
let str = '';
|
||||
const {length} = alphabet;
|
||||
while (size--) {
|
||||
str += alphabet[Math.random() * length|0];
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
|
||||
/**
|
||||
* If the thing is a FormData object, return true, otherwise return false.
|
||||
*
|
||||
* @param {unknown} thing - The thing to check.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isSpecCompliantForm(thing) {
|
||||
return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
||||
}
|
||||
|
||||
const toJSONObject = (obj) => {
|
||||
const stack = new Array(10);
|
||||
|
||||
@@ -678,6 +709,9 @@ var utils = {
|
||||
findKey,
|
||||
global: _global,
|
||||
isContextDefined,
|
||||
ALPHABET,
|
||||
generateString,
|
||||
isSpecCompliantForm,
|
||||
toJSONObject
|
||||
};
|
||||
|
||||
@@ -776,10 +810,8 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
|
||||
return axiosError;
|
||||
};
|
||||
|
||||
/* eslint-env browser */
|
||||
var browser = typeof self == 'object' ? self.FormData : window.FormData;
|
||||
|
||||
var FormData$2 = browser;
|
||||
// eslint-disable-next-line strict
|
||||
var httpAdapter = null;
|
||||
|
||||
/**
|
||||
* Determines if the given thing is a array or js object.
|
||||
@@ -836,17 +868,6 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
||||
return /^is[A-Z]/.test(prop);
|
||||
});
|
||||
|
||||
/**
|
||||
* If the thing is a FormData object, return true, otherwise return false.
|
||||
*
|
||||
* @param {unknown} thing - The thing to check.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isSpecCompliant(thing) {
|
||||
return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a data object to FormData
|
||||
*
|
||||
@@ -876,7 +897,7 @@ function toFormData(obj, formData, options) {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
formData = formData || new (FormData$2 || FormData)();
|
||||
formData = formData || new (FormData)();
|
||||
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
options = utils.toFlatObject(options, {
|
||||
@@ -894,7 +915,7 @@ function toFormData(obj, formData, options) {
|
||||
const dots = options.dots;
|
||||
const indexes = options.indexes;
|
||||
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
||||
const useBlob = _Blob && isSpecCompliant(formData);
|
||||
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
||||
|
||||
if (!utils.isFunction(visitor)) {
|
||||
throw new TypeError('visitor must be a function');
|
||||
@@ -1734,8 +1755,20 @@ class AxiosHeaders {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
clear() {
|
||||
return Object.keys(this).forEach(this.delete.bind(this));
|
||||
clear(matcher) {
|
||||
const keys = Object.keys(this);
|
||||
let i = keys.length;
|
||||
let deleted = false;
|
||||
|
||||
while (i--) {
|
||||
const key = keys[i];
|
||||
if(!matcher || matchHeaderValue(this, this[key], key, matcher)) {
|
||||
delete this[key];
|
||||
deleted = true;
|
||||
}
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
normalize(format) {
|
||||
@@ -1879,9 +1912,6 @@ utils.inherits(CanceledError, AxiosError, {
|
||||
__CANCEL__: true
|
||||
});
|
||||
|
||||
// eslint-disable-next-line strict
|
||||
var httpAdapter = null;
|
||||
|
||||
/**
|
||||
* Resolve or reject a Promise based on response status.
|
||||
*
|
||||
@@ -2582,7 +2612,7 @@ function mergeConfig(config1, config2) {
|
||||
return config;
|
||||
}
|
||||
|
||||
const VERSION = "1.2.6";
|
||||
const VERSION = "1.3.0";
|
||||
|
||||
const validators$1 = {};
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user