...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -436,6 +436,10 @@ | ||
| 436 | 436 | ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>); |
| 437 | 437 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); |
| 438 | 438 | fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>; |
| 439 | httpVersion?: 1 | 2; | |
| 440 | http2Options?: Record<string, any> & { | |
| 441 | sessionTimeout?: number; | |
| 442 | }; | |
| 439 | 443 | } |
| 440 | 444 | |
| 441 | 445 | // Alias |
@@ -1,5 +1,12 @@ | ||
| 1 | 1 | 'use strict'; |
| 2 | 2 | |
| 3 | /** | |
| 4 | * Create a bound version of a function with a specified `this` context | |
| 5 | * | |
| 6 | * @param {Function} fn - The function to bind | |
| 7 | * @param {*} thisArg - The value to be passed as the `this` parameter | |
| 8 | * @returns {Function} A new function that will call the original function with the specified `this` context | |
| 9 | */ | |
| 3 | 10 | export default function bind(fn, thisArg) { |
| 4 | 11 | return function wrap() { |
| 5 | 12 | return fn.apply(thisArg, arguments); |
@@ -5,27 +5,38 @@ | ||
| 5 | 5 | |
| 6 | 6 | // Standard browser envs support document.cookie |
| 7 | 7 | { |
| 8 | write(name, value, expires, path, domain, secure) { | |
| 9 | const cookie = [name + '=' + encodeURIComponent(value)]; | |
| 8 | write(name, value, expires, path, domain, secure, sameSite) { | |
| 9 | if (typeof document === 'undefined') return; | |
| 10 | 10 | |
| 11 | utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); | |
| 11 | const cookie = [`${name}=${encodeURIComponent(value)}`]; | |
| 12 | 12 | |
| 13 | utils.isString(path) && cookie.push('path=' + path); | |
| 13 | if (utils.isNumber(expires)) { | |
| 14 | cookie.push(`expires=${new Date(expires).toUTCString()}`); | |
| 15 | } | |
| 16 | if (utils.isString(path)) { | |
| 17 | cookie.push(`path=${path}`); | |
| 18 | } | |
| 19 | if (utils.isString(domain)) { | |
| 20 | cookie.push(`domain=${domain}`); | |
| 21 | } | |
| 22 | if (secure === true) { | |
| 23 | cookie.push('secure'); | |
| 24 | } | |
| 25 | if (utils.isString(sameSite)) { | |
| 26 | cookie.push(`SameSite=${sameSite}`); | |
| 27 | } | |
| 14 | 28 | |
| 15 | utils.isString(domain) && cookie.push('domain=' + domain); | |
| 16 | ||
| 17 | secure === true && cookie.push('secure'); | |
| 18 | ||
| 19 | 29 | document.cookie = cookie.join('; '); |
| 20 | 30 | }, |
| 21 | 31 | |
| 22 | 32 | read(name) { |
| 23 | const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); | |
| 24 | return (match ? decodeURIComponent(match[3]) : null); | |
| 33 | if (typeof document === 'undefined') return null; | |
| 34 | const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)')); | |
| 35 | return match ? decodeURIComponent(match[1]) : null; | |
| 25 | 36 | }, |
| 26 | 37 | |
| 27 | 38 | remove(name) { |
| 28 | this.write(name, '', Date.now() - 86400000); | |
| 39 | this.write(name, '', Date.now() - 86400000, '/'); | |
| 29 | 40 | } |
| 30 | 41 | } |
| 31 | 42 | |
@@ -62,6 +62,12 @@ | ||
| 62 | 62 | LoopDetected: 508, |
| 63 | 63 | NotExtended: 510, |
| 64 | 64 | NetworkAuthenticationRequired: 511, |
| 65 | WebServerIsDown: 521, | |
| 66 | ConnectionTimedOut: 522, | |
| 67 | OriginIsUnreachable: 523, | |
| 68 | TimeoutOccurred: 524, | |
| 69 | SslHandshakeFailed: 525, | |
| 70 | InvalidSslCertificate: 526, | |
| 65 | 71 | }; |
| 66 | 72 | |
| 67 | 73 | Object.entries(HttpStatusCode).forEach(([key, value]) => { |
@@ -31,11 +31,11 @@ | ||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | // eslint-disable-next-line consistent-return |
| 34 | function mergeDeepProperties(a, b, prop , caseless) { | |
| 34 | function mergeDeepProperties(a, b, prop, caseless) { | |
| 35 | 35 | if (!utils.isUndefined(b)) { |
| 36 | return getMergedValue(a, b, prop , caseless); | |
| 36 | return getMergedValue(a, b, prop, caseless); | |
| 37 | 37 | } else if (!utils.isUndefined(a)) { |
| 38 | return getMergedValue(undefined, a, prop , caseless); | |
| 38 | return getMergedValue(undefined, a, prop, caseless); | |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
@@ -93,7 +93,7 @@ | ||
| 93 | 93 | socketPath: defaultToConfig2, |
| 94 | 94 | responseEncoding: defaultToConfig2, |
| 95 | 95 | validateStatus: mergeDirectKeys, |
| 96 | headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true) | |
| 96 | headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true) | |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | 99 | utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) { |
@@ -1,6 +1,6 @@ | ||
| 1 | 1 | { |
| 2 | 2 | "name": "axios", |
| 3 | "version": "1.12.2", | |
| 3 | "version": "1.13.0", | |
| 4 | 4 | "description": "Promise based HTTP client for the browser and node.js", |
| 5 | 5 | "main": "index.js", |
| 6 | 6 | "exports": { |
@@ -80,7 +80,12 @@ | ||
| 80 | 80 | "http", |
| 81 | 81 | "ajax", |
| 82 | 82 | "promise", |
| 83 | "node" | |
| 83 | "node", | |
| 84 | "browser", | |
| 85 | "fetch", | |
| 86 | "rest", | |
| 87 | "api", | |
| 88 | "client" | |
| 84 | 89 | ], |
| 85 | 90 | "author": "Matt Zabriskie", |
| 86 | 91 | "license": "MIT", |
@@ -141,11 +146,11 @@ | ||
| 141 | 146 | "rollup-plugin-auto-external": "^2.0.0", |
| 142 | 147 | "rollup-plugin-bundle-size": "^1.0.3", |
| 143 | 148 | "rollup-plugin-terser": "^7.0.2", |
| 149 | "selfsigned": "^3.0.1", | |
| 144 | 150 | "sinon": "^4.5.0", |
| 145 | 151 | "stream-throttle": "^0.1.3", |
| 146 | 152 | "string-replace-async": "^3.0.2", |
| 147 | 153 | "tar-stream": "^3.1.7", |
| 148 | "terser-webpack-plugin": "^4.2.3", | |
| 149 | 154 | "typescript": "^4.9.5" |
| 150 | 155 | }, |
| 151 | 156 | "browser": { |
@@ -185,7 +190,7 @@ | ||
| 185 | 190 | "Remco Haszing (https://github.com/remcohaszing)", |
| 186 | 191 | "Rikki Gibson (https://github.com/RikkiGibson)", |
| 187 | 192 | "Willian Agostini (https://github.com/WillianAgostini)", |
| 188 | "Yasu Flores (https://github.com/yasuf)" | |
| 193 | "Ben Carp (https://github.com/carpben)" | |
| 189 | 194 | ], |
| 190 | 195 | "sideEffects": false, |
| 191 | 196 | "release-it": { |
@@ -369,6 +369,10 @@ | ||
| 369 | 369 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); |
| 370 | 370 | parseReviver?: (this: any, key: string, value: any) => any; |
| 371 | 371 | fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>; |
| 372 | httpVersion?: 1 | 2; | |
| 373 | http2Options?: Record<string, any> & { | |
| 374 | sessionTimeout?: number; | |
| 375 | }; | |
| 372 | 376 | } |
| 373 | 377 | |
| 374 | 378 | // Alias |