...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -436,6 +436,10 @@ | |||
| 436 | ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>); | 436 | ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>); |
| 437 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); | 437 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); |
| 438 | fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>; | 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 | // Alias | 445 | // Alias |
@@ -1,5 +1,12 @@ | |||
| 1 | 'use strict'; | 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 | export default function bind(fn, thisArg) { | 10 | export default function bind(fn, thisArg) { |
| 4 | return function wrap() { | 11 | return function wrap() { |
| 5 | return fn.apply(thisArg, arguments); | 12 | return fn.apply(thisArg, arguments); |
@@ -5,27 +5,38 @@ | |||
| 5 | 5 | ||
| 6 | // Standard browser envs support document.cookie | 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 | document.cookie = cookie.join('; '); | 29 | document.cookie = cookie.join('; '); |
| 20 | }, | 30 | }, |
| 21 | 31 | ||
| 22 | read(name) { | 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 | remove(name) { | 38 | remove(name) { |
| 28 | this.write(name, '', Date.now() - 86400000); | 39 | this.write(name, '', Date.now() - 86400000, '/'); |
| 29 | } | 40 | } |
| 30 | } | 41 | } |
| 31 | 42 | ||
@@ -262,7 +262,7 @@ | |||
| 262 | const seedCache = new Map(); | 262 | const seedCache = new Map(); |
| 263 | 263 | ||
| 264 | export const getFetch = (config) => { | 264 | export const getFetch = (config) => { |
| 265 | let env = config ? config.env : {}; | 265 | let env = (config && config.env) || {}; |
| 266 | const {fetch, Request, Response} = env; | 266 | const {fetch, Request, Response} = env; |
| 267 | const seeds = [ | 267 | const seeds = [ |
| 268 | Request, Response, fetch | 268 | Request, Response, fetch |
@@ -62,6 +62,12 @@ | |||
| 62 | LoopDetected: 508, | 62 | LoopDetected: 508, |
| 63 | NotExtended: 510, | 63 | NotExtended: 510, |
| 64 | NetworkAuthenticationRequired: 511, | 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 | Object.entries(HttpStatusCode).forEach(([key, value]) => { | 73 | Object.entries(HttpStatusCode).forEach(([key, value]) => { |
@@ -30,7 +30,7 @@ | |||
| 30 | * | 30 | * |
| 31 | * @param {Number} id The ID that was returned by `use` | 31 | * @param {Number} id The ID that was returned by `use` |
| 32 | * | 32 | * |
| 33 | * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise | 33 | * @returns {void} |
| 34 | */ | 34 | */ |
| 35 | eject(id) { | 35 | eject(id) { |
| 36 | if (this.handlers[id]) { | 36 | if (this.handlers[id]) { |
@@ -31,11 +31,11 @@ | |||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | // eslint-disable-next-line consistent-return | 33 | // eslint-disable-next-line consistent-return |
| 34 | function mergeDeepProperties(a, b, prop , caseless) { | 34 | function mergeDeepProperties(a, b, prop, caseless) { |
| 35 | if (!utils.isUndefined(b)) { | 35 | if (!utils.isUndefined(b)) { |
| 36 | return getMergedValue(a, b, prop , caseless); | 36 | return getMergedValue(a, b, prop, caseless); |
| 37 | } else if (!utils.isUndefined(a)) { | 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 | socketPath: defaultToConfig2, | 93 | socketPath: defaultToConfig2, |
| 94 | responseEncoding: defaultToConfig2, | 94 | responseEncoding: defaultToConfig2, |
| 95 | validateStatus: mergeDirectKeys, | 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 | utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) { | 99 | utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) { |
@@ -1,6 +1,6 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "axios", | 2 | "name": "axios", |
| 3 | "version": "1.12.2", | 3 | "version": "1.13.0", |
| 4 | "description": "Promise based HTTP client for the browser and node.js", | 4 | "description": "Promise based HTTP client for the browser and node.js", |
| 5 | "main": "index.js", | 5 | "main": "index.js", |
| 6 | "exports": { | 6 | "exports": { |
@@ -80,7 +80,12 @@ | |||
| 80 | "http", | 80 | "http", |
| 81 | "ajax", | 81 | "ajax", |
| 82 | "promise", | 82 | "promise", |
| 83 | "node" | 83 | "node", |
| 84 | "browser", | ||
| 85 | "fetch", | ||
| 86 | "rest", | ||
| 87 | "api", | ||
| 88 | "client" | ||
| 84 | ], | 89 | ], |
| 85 | "author": "Matt Zabriskie", | 90 | "author": "Matt Zabriskie", |
| 86 | "license": "MIT", | 91 | "license": "MIT", |
@@ -141,11 +146,11 @@ | |||
| 141 | "rollup-plugin-auto-external": "^2.0.0", | 146 | "rollup-plugin-auto-external": "^2.0.0", |
| 142 | "rollup-plugin-bundle-size": "^1.0.3", | 147 | "rollup-plugin-bundle-size": "^1.0.3", |
| 143 | "rollup-plugin-terser": "^7.0.2", | 148 | "rollup-plugin-terser": "^7.0.2", |
| 149 | "selfsigned": "^3.0.1", | ||
| 144 | "sinon": "^4.5.0", | 150 | "sinon": "^4.5.0", |
| 145 | "stream-throttle": "^0.1.3", | 151 | "stream-throttle": "^0.1.3", |
| 146 | "string-replace-async": "^3.0.2", | 152 | "string-replace-async": "^3.0.2", |
| 147 | "tar-stream": "^3.1.7", | 153 | "tar-stream": "^3.1.7", |
| 148 | "terser-webpack-plugin": "^4.2.3", | ||
| 149 | "typescript": "^4.9.5" | 154 | "typescript": "^4.9.5" |
| 150 | }, | 155 | }, |
| 151 | "browser": { | 156 | "browser": { |
@@ -185,7 +190,7 @@ | |||
| 185 | "Remco Haszing (https://github.com/remcohaszing)", | 190 | "Remco Haszing (https://github.com/remcohaszing)", |
| 186 | "Rikki Gibson (https://github.com/RikkiGibson)", | 191 | "Rikki Gibson (https://github.com/RikkiGibson)", |
| 187 | "Willian Agostini (https://github.com/WillianAgostini)", | 192 | "Willian Agostini (https://github.com/WillianAgostini)", |
| 188 | "Yasu Flores (https://github.com/yasuf)" | 193 | "Ben Carp (https://github.com/carpben)" |
| 189 | ], | 194 | ], |
| 190 | "sideEffects": false, | 195 | "sideEffects": false, |
| 191 | "release-it": { | 196 | "release-it": { |
@@ -369,6 +369,10 @@ | |||
| 369 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); | 369 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); |
| 370 | parseReviver?: (this: any, key: string, value: any) => any; | 370 | parseReviver?: (this: any, key: string, value: any) => any; |
| 371 | fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>; | 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 | // Alias | 378 | // Alias |