...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -16,6 +16,8 @@ | |||
| 16 | 16 | ||
| 17 | type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding'; | 17 | type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding'; |
| 18 | 18 | ||
| 19 | type BrowserProgressEvent = any; | ||
| 20 | |||
| 19 | declare class AxiosHeaders { | 21 | declare class AxiosHeaders { |
| 20 | constructor( | 22 | constructor( |
| 21 | headers?: RawAxiosHeaders | AxiosHeaders | string | 23 | headers?: RawAxiosHeaders | AxiosHeaders | string |
@@ -98,7 +100,8 @@ | |||
| 98 | isAxiosError: boolean; | 100 | isAxiosError: boolean; |
| 99 | status?: number; | 101 | status?: number; |
| 100 | toJSON: () => object; | 102 | toJSON: () => object; |
| 101 | cause?: Error; | 103 | cause?: unknown; |
| 104 | event?: BrowserProgressEvent; | ||
| 102 | static from<T = unknown, D = any>( | 105 | static from<T = unknown, D = any>( |
| 103 | error: Error | unknown, | 106 | error: Error | unknown, |
| 104 | code?: string, | 107 | code?: string, |
@@ -352,8 +355,6 @@ | |||
| 352 | 355 | ||
| 353 | type MaxDownloadRate = number; | 356 | type MaxDownloadRate = number; |
| 354 | 357 | ||
| 355 | type BrowserProgressEvent = any; | ||
| 356 | |||
| 357 | interface AxiosProgressEvent { | 358 | interface AxiosProgressEvent { |
| 358 | loaded: number; | 359 | loaded: number; |
| 359 | total?: number; | 360 | total?: number; |
@@ -422,6 +423,9 @@ | |||
| 422 | insecureHTTPParser?: boolean; | 423 | insecureHTTPParser?: boolean; |
| 423 | env?: { | 424 | env?: { |
| 424 | FormData?: new (...args: any[]) => object; | 425 | FormData?: new (...args: any[]) => object; |
| 426 | fetch?: (input: URL | Request | string, init?: RequestInit) => Promise<Response>; | ||
| 427 | Request?: new (input: (RequestInfo | URL), init?: RequestInit) => Request; | ||
| 428 | Response?: new (body?: (BodyInit | null), init?: ResponseInit) => Response; | ||
| 425 | }; | 429 | }; |
| 426 | formSerializer?: FormSerializerOptions; | 430 | formSerializer?: FormSerializerOptions; |
| 427 | family?: AddressFamily; | 431 | family?: AddressFamily; |
@@ -460,11 +464,11 @@ | |||
| 460 | headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>; | 464 | headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>; |
| 461 | } | 465 | } |
| 462 | 466 | ||
| 463 | interface AxiosResponse<T = any, D = any> { | 467 | interface AxiosResponse<T = any, D = any, H = {}> { |
| 464 | data: T; | 468 | data: T; |
| 465 | status: number; | 469 | status: number; |
| 466 | statusText: string; | 470 | statusText: string; |
| 467 | headers: RawAxiosResponseHeaders | AxiosResponseHeaders; | 471 | headers: H & RawAxiosResponseHeaders | AxiosResponseHeaders; |
| 468 | config: InternalAxiosRequestConfig<D>; | 472 | config: InternalAxiosRequestConfig<D>; |
| 469 | request?: any; | 473 | request?: any; |
| 470 | } | 474 | } |
@@ -1,13 +1,15 @@ | |||
| 1 | import utils from '../utils.js'; | 1 | import utils from '../utils.js'; |
| 2 | import httpAdapter from './http.js'; | 2 | import httpAdapter from './http.js'; |
| 3 | import xhrAdapter from './xhr.js'; | 3 | import xhrAdapter from './xhr.js'; |
| 4 | import fetchAdapter from './fetch.js'; | 4 | import * as fetchAdapter from './fetch.js'; |
| 5 | import AxiosError from "../core/AxiosError.js"; | 5 | import AxiosError from "../core/AxiosError.js"; |
| 6 | 6 | ||
| 7 | const knownAdapters = { | 7 | const knownAdapters = { |
| 8 | http: httpAdapter, | 8 | http: httpAdapter, |
| 9 | xhr: xhrAdapter, | 9 | xhr: xhrAdapter, |
| 10 | fetch: fetchAdapter | 10 | fetch: { |
| 11 | get: fetchAdapter.getFetch, | ||
| 12 | } | ||
| 11 | } | 13 | } |
| 12 | 14 | ||
| 13 | utils.forEach(knownAdapters, (fn, value) => { | 15 | utils.forEach(knownAdapters, (fn, value) => { |
@@ -26,7 +28,7 @@ | |||
| 26 | const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false; | 28 | const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false; |
| 27 | 29 | ||
| 28 | export default { | 30 | export default { |
| 29 | getAdapter: (adapters) => { | 31 | getAdapter: (adapters, config) => { |
| 30 | adapters = utils.isArray(adapters) ? adapters : [adapters]; | 32 | adapters = utils.isArray(adapters) ? adapters : [adapters]; |
| 31 | 33 | ||
| 32 | const {length} = adapters; | 34 | const {length} = adapters; |
@@ -49,7 +51,7 @@ | |||
| 49 | } | 51 | } |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 52 | if (adapter) { | 54 | if (adapter && (utils.isFunction(adapter) || (adapter = adapter.get(config)))) { |
| 53 | break; | 55 | break; |
| 54 | } | 56 | } |
| 55 | 57 | ||
@@ -89,12 +89,19 @@ | |||
| 89 | return prop !== 'isAxiosError'; | 89 | return prop !== 'isAxiosError'; |
| 90 | }); | 90 | }); |
| 91 | 91 | ||
| 92 | AxiosError.call(axiosError, error.message, code, config, request, response); | 92 | const msg = error && error.message ? error.message : 'Error'; |
| 93 | 93 | ||
| 94 | axiosError.cause = error; | 94 | // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED) |
| 95 | const errCode = code == null && error ? error.code : code; | ||
| 96 | AxiosError.call(axiosError, msg, errCode, config, request, response); | ||
| 95 | 97 | ||
| 96 | axiosError.name = error.name; | 98 | // Chain the original error on the standard field; non-enumerable to avoid JSON noise |
| 99 | if (error && axiosError.cause == null) { | ||
| 100 | Object.defineProperty(axiosError, 'cause', { value: error, configurable: true }); | ||
| 101 | } | ||
| 97 | 102 | ||
| 103 | axiosError.name = (error && error.name) || 'Error'; | ||
| 104 | |||
| 98 | customProps && Object.assign(axiosError, customProps); | 105 | customProps && Object.assign(axiosError, customProps); |
| 99 | 106 | ||
| 100 | return axiosError; | 107 | return axiosError; |
@@ -46,7 +46,7 @@ | |||
| 46 | config.headers.setContentType('application/x-www-form-urlencoded', false); | 46 | config.headers.setContentType('application/x-www-form-urlencoded', false); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | const adapter = adapters.getAdapter(config.adapter || defaults.adapter); | 49 | const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config); |
| 50 | 50 | ||
| 51 | return adapter(config).then(function onAdapterResolution(response) { | 51 | return adapter(config).then(function onAdapterResolution(response) { |
| 52 | throwIfCancellationRequested(config); | 52 | throwIfCancellationRequested(config); |
@@ -25,6 +25,7 @@ | |||
| 25 | import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js'; | 25 | import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js'; |
| 26 | import callbackify from "../helpers/callbackify.js"; | 26 | import callbackify from "../helpers/callbackify.js"; |
| 27 | import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js"; | 27 | import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js"; |
| 28 | import estimateDataURLDecodedBytes from '../helpers/estimateDataURLDecodedBytes.js'; | ||
| 28 | 29 | ||
| 29 | const zlibOptions = { | 30 | const zlibOptions = { |
| 30 | flush: zlib.constants.Z_SYNC_FLUSH, | 31 | flush: zlib.constants.Z_SYNC_FLUSH, |
@@ -46,6 +47,7 @@ | |||
| 46 | return protocol + ':'; | 47 | return protocol + ':'; |
| 47 | }); | 48 | }); |
| 48 | 49 | ||
| 50 | |||
| 49 | const flushOnFinish = (stream, [throttled, flush]) => { | 51 | const flushOnFinish = (stream, [throttled, flush]) => { |
| 50 | stream | 52 | stream |
| 51 | .on('end', flush) | 53 | .on('end', flush) |
@@ -54,6 +56,7 @@ | |||
| 54 | return throttled; | 56 | return throttled; |
| 55 | } | 57 | } |
| 56 | 58 | ||
| 59 | |||
| 57 | /** | 60 | /** |
| 58 | * If the proxy or config beforeRedirects functions are defined, call them with the options | 61 | * If the proxy or config beforeRedirects functions are defined, call them with the options |
| 59 | * object. | 62 | * object. |
@@ -233,6 +236,21 @@ | |||
| 233 | const protocol = parsed.protocol || supportedProtocols[0]; | 236 | const protocol = parsed.protocol || supportedProtocols[0]; |
| 234 | 237 | ||
| 235 | if (protocol === 'data:') { | 238 | if (protocol === 'data:') { |
| 239 | // Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set. | ||
| 240 | if (config.maxContentLength > -1) { | ||
| 241 | // Use the exact string passed to fromDataURI (config.url); fall back to fullPath if needed. | ||
| 242 | const dataUrl = String(config.url || fullPath || ''); | ||
| 243 | const estimated = estimateDataURLDecodedBytes(dataUrl); | ||
| 244 | |||
| 245 | if (estimated > config.maxContentLength) { | ||
| 246 | return reject(new AxiosError( | ||
| 247 | 'maxContentLength size of ' + config.maxContentLength + ' exceeded', | ||
| 248 | AxiosError.ERR_BAD_RESPONSE, | ||
| 249 | config | ||
| 250 | )); | ||
| 251 | } | ||
| 252 | } | ||
| 253 | |||
| 236 | let convertedData; | 254 | let convertedData; |
| 237 | 255 | ||
| 238 | if (method !== 'GET') { | 256 | if (method !== 'GET') { |
@@ -111,7 +111,7 @@ | |||
| 111 | const strictJSONParsing = !silentJSONParsing && JSONRequested; | 111 | const strictJSONParsing = !silentJSONParsing && JSONRequested; |
| 112 | 112 | ||
| 113 | try { | 113 | try { |
| 114 | return JSON.parse(data); | 114 | return JSON.parse(data, this.parseReviver); |
| 115 | } catch (e) { | 115 | } catch (e) { |
| 116 | if (strictJSONParsing) { | 116 | if (strictJSONParsing) { |
| 117 | if (e.name === 'SyntaxError') { | 117 | if (e.name === 'SyntaxError') { |
@@ -10,7 +10,7 @@ | |||
| 10 | export default (config) => { | 10 | export default (config) => { |
| 11 | const newConfig = mergeConfig({}, config); | 11 | const newConfig = mergeConfig({}, config); |
| 12 | 12 | ||
| 13 | let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; | 13 | let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig; |
| 14 | 14 | ||
| 15 | newConfig.headers = headers = AxiosHeaders.from(headers); | 15 | newConfig.headers = headers = AxiosHeaders.from(headers); |
| 16 | 16 | ||
@@ -23,17 +23,21 @@ | |||
| 23 | ); | 23 | ); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | let contentType; | ||
| 27 | |||
| 28 | if (utils.isFormData(data)) { | 26 | if (utils.isFormData(data)) { |
| 29 | if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { | 27 | if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { |
| 30 | headers.setContentType(undefined); // Let the browser set it | ||
| 31 | } else if ((contentType = headers.getContentType()) !== false) { | ||
| 32 | // fix semicolon duplication issue for ReactNative FormData implementation | ||
| 33 | const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; | ||
| 34 | headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); | 28 | headers.setContentType(undefined); // browser handles it |
| 29 | } else if (utils.isFunction(data.getHeaders)) { | ||
| 30 | // Node.js FormData (like form-data package) | ||
| 31 | const formHeaders = data.getHeaders(); | ||
| 32 | // Only set safe headers to avoid overwriting security headers | ||
| 33 | const allowedHeaders = ['content-type', 'content-length']; | ||
| 34 | Object.entries(formHeaders).forEach(([key, val]) => { | ||
| 35 | if (allowedHeaders.includes(key.toLowerCase())) { | ||
| 36 | headers.set(key, val); | ||
| 37 | } | ||
| 38 | }); | ||
| 35 | } | 39 | } |
| 36 | } | 40 | } |
| 37 | 41 | ||
| 38 | // Add xsrf header | 42 | // Add xsrf header |
| 39 | // This is only done if running in a standard browser environment. | 43 | // This is only done if running in a standard browser environment. |
@@ -148,7 +148,7 @@ | |||
| 148 | if (!isObject(val) || isBuffer(val)) { | 148 | if (!isObject(val) || isBuffer(val)) { |
| 149 | return false; | 149 | return false; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | try { | 152 | try { |
| 153 | return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype; | 153 | return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype; |
| 154 | } catch (e) { | 154 | } catch (e) { |
@@ -341,7 +341,7 @@ | |||
| 341 | * @returns {Object} Result of all merge properties | 341 | * @returns {Object} Result of all merge properties |
| 342 | */ | 342 | */ |
| 343 | function merge(/* obj1, obj2, obj3, ... */) { | 343 | function merge(/* obj1, obj2, obj3, ... */) { |
| 344 | const {caseless} = isContextDefined(this) && this || {}; | 344 | const {caseless, skipUndefined} = isContextDefined(this) && this || {}; |
| 345 | const result = {}; | 345 | const result = {}; |
| 346 | const assignValue = (val, key) => { | 346 | const assignValue = (val, key) => { |
| 347 | const targetKey = caseless && findKey(result, key) || key; | 347 | const targetKey = caseless && findKey(result, key) || key; |
@@ -352,7 +352,9 @@ | |||
| 352 | } else if (isArray(val)) { | 352 | } else if (isArray(val)) { |
| 353 | result[targetKey] = val.slice(); | 353 | result[targetKey] = val.slice(); |
| 354 | } else { | 354 | } else { |
| 355 | result[targetKey] = val; | 355 | if (!skipUndefined || !isUndefined(val)) { |
| 356 | result[targetKey] = val; | ||
| 357 | } | ||
| 356 | } | 358 | } |
| 357 | } | 359 | } |
| 358 | 360 | ||
@@ -633,6 +635,8 @@ | |||
| 633 | return value != null && Number.isFinite(value = +value) ? value : defaultValue; | 635 | return value != null && Number.isFinite(value = +value) ? value : defaultValue; |
| 634 | } | 636 | } |
| 635 | 637 | ||
| 638 | |||
| 639 | |||
| 636 | /** | 640 | /** |
| 637 | * If the thing is a FormData object, return true, otherwise return false. | 641 | * If the thing is a FormData object, return true, otherwise return false. |
| 638 | * | 642 | * |
@@ -104,15 +104,18 @@ | |||
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | // Handle low level network errors | 106 | // Handle low level network errors |
| 107 | request.onerror = function handleError() { | ||
| 108 | // Real errors are hidden from us by the browser | ||
| 109 | // onerror should only fire if it's a network error | ||
| 110 | reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request)); | ||
| 111 | |||
| 112 | // Clean up request | ||
| 113 | request = null; | 107 | request.onerror = function handleError(event) { |
| 108 | // Browsers deliver a ProgressEvent in XHR onerror | ||
| 109 | // (message may be empty; when present, surface it) | ||
| 110 | // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event | ||
| 111 | const msg = event && event.message ? event.message : 'Network Error'; | ||
| 112 | const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request); | ||
| 113 | // attach the underlying event for consumers who want details | ||
| 114 | err.event = event || null; | ||
| 115 | reject(err); | ||
| 116 | request = null; | ||
| 114 | }; | 117 | }; |
| 115 | 118 | ||
| 116 | // Handle timeout | 119 | // Handle timeout |
| 117 | request.ontimeout = function handleTimeout() { | 120 | request.ontimeout = function handleTimeout() { |
| 118 | let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; | 121 | let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; |
@@ -1,6 +1,6 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "axios", | 2 | "name": "axios", |
| 3 | "version": "1.11.0", | 3 | "version": "1.12.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": { |
@@ -33,7 +33,9 @@ | |||
| 33 | "./unsafe/adapters/http.js": "./lib/adapters/http.js", | 33 | "./unsafe/adapters/http.js": "./lib/adapters/http.js", |
| 34 | "./unsafe/adapters/xhr.js": "./lib/adapters/xhr.js", | 34 | "./unsafe/adapters/xhr.js": "./lib/adapters/xhr.js", |
| 35 | "./unsafe/utils.js": "./lib/utils.js", | 35 | "./unsafe/utils.js": "./lib/utils.js", |
| 36 | "./package.json": "./package.json" | 36 | "./package.json": "./package.json", |
| 37 | "./dist/browser/axios.cjs": "./dist/browser/axios.cjs", | ||
| 38 | "./dist/node/axios.cjs": "./dist/node/axios.cjs" | ||
| 37 | }, | 39 | }, |
| 38 | "type": "module", | 40 | "type": "module", |
| 39 | "types": "index.d.ts", | 41 | "types": "index.d.ts", |
@@ -49,7 +51,7 @@ | |||
| 49 | "test:build:version": "node ./bin/check-build-version.js", | 51 | "test:build:version": "node ./bin/check-build-version.js", |
| 50 | "start": "node ./sandbox/server.js", | 52 | "start": "node ./sandbox/server.js", |
| 51 | "preversion": "gulp version", | 53 | "preversion": "gulp version", |
| 52 | "version": "npm run build && git add dist && git add package.json", | 54 | "version": "npm run build && git add package.json", |
| 53 | "prepublishOnly": "npm run test:build:version", | 55 | "prepublishOnly": "npm run test:build:version", |
| 54 | "postpublish": "git push && git push --tags", | 56 | "postpublish": "git push && git push --tags", |
| 55 | "build": "gulp clear && cross-env NODE_ENV=production rollup -c -m", | 57 | "build": "gulp clear && cross-env NODE_ENV=production rollup -c -m", |
@@ -89,6 +91,7 @@ | |||
| 89 | "@commitlint/cli": "^17.8.1", | 91 | "@commitlint/cli": "^17.8.1", |
| 90 | "@commitlint/config-conventional": "^17.8.1", | 92 | "@commitlint/config-conventional": "^17.8.1", |
| 91 | "@release-it/conventional-changelog": "^5.1.1", | 93 | "@release-it/conventional-changelog": "^5.1.1", |
| 94 | "@rollup/plugin-alias": "^5.1.0", | ||
| 92 | "@rollup/plugin-babel": "^5.3.1", | 95 | "@rollup/plugin-babel": "^5.3.1", |
| 93 | "@rollup/plugin-commonjs": "^15.1.0", | 96 | "@rollup/plugin-commonjs": "^15.1.0", |
| 94 | "@rollup/plugin-json": "^4.1.0", | 97 | "@rollup/plugin-json": "^4.1.0", |
@@ -110,7 +113,6 @@ | |||
| 110 | "fs-extra": "^10.1.0", | 113 | "fs-extra": "^10.1.0", |
| 111 | "get-stream": "^3.0.0", | 114 | "get-stream": "^3.0.0", |
| 112 | "gulp": "^4.0.2", | 115 | "gulp": "^4.0.2", |
| 113 | "gzip-size": "^7.0.0", | ||
| 114 | "handlebars": "^4.7.8", | 116 | "handlebars": "^4.7.8", |
| 115 | "husky": "^8.0.3", | 117 | "husky": "^8.0.3", |
| 116 | "istanbul-instrumenter-loader": "^3.0.1", | 118 | "istanbul-instrumenter-loader": "^3.0.1", |
@@ -129,6 +131,7 @@ | |||
| 129 | "minimist": "^1.2.8", | 131 | "minimist": "^1.2.8", |
| 130 | "mocha": "^10.3.0", | 132 | "mocha": "^10.3.0", |
| 131 | "multer": "^1.4.4", | 133 | "multer": "^1.4.4", |
| 134 | "pacote": "^20.0.0", | ||
| 132 | "pretty-bytes": "^6.1.1", | 135 | "pretty-bytes": "^6.1.1", |
| 133 | "release-it": "^15.11.0", | 136 | "release-it": "^15.11.0", |
| 134 | "rollup": "^2.79.1", | 137 | "rollup": "^2.79.1", |
@@ -138,9 +141,9 @@ | |||
| 138 | "sinon": "^4.5.0", | 141 | "sinon": "^4.5.0", |
| 139 | "stream-throttle": "^0.1.3", | 142 | "stream-throttle": "^0.1.3", |
| 140 | "string-replace-async": "^3.0.2", | 143 | "string-replace-async": "^3.0.2", |
| 144 | "tar-stream": "^3.1.7", | ||
| 141 | "terser-webpack-plugin": "^4.2.3", | 145 | "terser-webpack-plugin": "^4.2.3", |
| 142 | "typescript": "^4.9.5", | ||
| 143 | "@rollup/plugin-alias": "^5.1.0" | 146 | "typescript": "^4.9.5" |
| 144 | }, | 147 | }, |
| 145 | "browser": { | 148 | "browser": { |
| 146 | "./lib/adapters/http.js": "./lib/helpers/null.js", | 149 | "./lib/adapters/http.js": "./lib/helpers/null.js", |
@@ -178,7 +181,7 @@ | |||
| 178 | "Xianming Zhong (https://github.com/chinesedfan)", | 181 | "Xianming Zhong (https://github.com/chinesedfan)", |
| 179 | "Remco Haszing (https://github.com/remcohaszing)", | 182 | "Remco Haszing (https://github.com/remcohaszing)", |
| 180 | "Rikki Gibson (https://github.com/RikkiGibson)", | 183 | "Rikki Gibson (https://github.com/RikkiGibson)", |
| 181 | "Ben Carp (https://github.com/carpben)", | 184 | "Willian Agostini (https://github.com/WillianAgostini)", |
| 182 | "Yasu Flores (https://github.com/yasuf)" | 185 | "Yasu Flores (https://github.com/yasuf)" |
| 183 | ], | 186 | ], |
| 184 | "sideEffects": false, | 187 | "sideEffects": false, |
@@ -208,8 +211,8 @@ | |||
| 208 | }, | 211 | }, |
| 209 | "hooks": { | 212 | "hooks": { |
| 210 | "before:init": "npm test", | 213 | "before:init": "npm test", |
| 211 | "after:bump": "gulp version --bump ${version} && npm run build && npm run test:build:version && git add ./dist && git add ./package-lock.json", | ||
| 212 | "before:release": "npm run release:changelog:fix", | 214 | "after:bump": "gulp version --bump ${version} && npm run build && npm run test:build:version", |
| 215 | "before:release": "npm run release:changelog:fix && git add ./package-lock.json", | ||
| 213 | "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}." | 216 | "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}." |
| 214 | } | 217 | } |
| 215 | }, | 218 | }, |
@@ -1,5 +1,40 @@ | |||
| 1 | # Changelog | 1 | # Changelog |
| 2 | 2 | ||
| 3 | # [1.12.0](https://github.com/axios/axios/compare/v1.11.0...v1.12.0) (2025-09-11) | ||
| 4 | |||
| 5 | |||
| 6 | ### Bug Fixes | ||
| 7 | |||
| 8 | * adding build artifacts ([9ec86de](https://github.com/axios/axios/commit/9ec86de257bfa33856571036279169f385ed92bd)) | ||
| 9 | * dont add dist on release ([a2edc36](https://github.com/axios/axios/commit/a2edc3606a4f775d868a67bb3461ff18ce7ecd11)) | ||
| 10 | * **fetch-adapter:** set correct Content-Type for Node FormData ([#6998](https://github.com/axios/axios/issues/6998)) ([a9f47af](https://github.com/axios/axios/commit/a9f47afbf3224d2ca987dbd8188789c7ea853c5d)) | ||
| 11 | * **node:** enforce maxContentLength for data: URLs ([#7011](https://github.com/axios/axios/issues/7011)) ([945435f](https://github.com/axios/axios/commit/945435fc51467303768202250debb8d4ae892593)) | ||
| 12 | * package exports ([#5627](https://github.com/axios/axios/issues/5627)) ([aa78ac2](https://github.com/axios/axios/commit/aa78ac23fc9036163308c0f6bd2bb885e7af3f36)) | ||
| 13 | * **params:** removing '[' and ']' from URL encode exclude characters ([#3316](https://github.com/axios/axios/issues/3316)) ([#5715](https://github.com/axios/axios/issues/5715)) ([6d84189](https://github.com/axios/axios/commit/6d84189349c43b1dcdd977b522610660cc4c7042)) | ||
| 14 | * release pr run ([fd7f404](https://github.com/axios/axios/commit/fd7f404488b2c4f238c2fbe635b58026a634bfd2)) | ||
| 15 | * **types:** change the type guard on isCancel ([#5595](https://github.com/axios/axios/issues/5595)) ([0dbb7fd](https://github.com/axios/axios/commit/0dbb7fd4f61dc568498cd13a681fa7f907d6ec7e)) | ||
| 16 | |||
| 17 | |||
| 18 | ### Features | ||
| 19 | |||
| 20 | * **adapter:** surface low‑level network error details; attach original error via cause ([#6982](https://github.com/axios/axios/issues/6982)) ([78b290c](https://github.com/axios/axios/commit/78b290c57c978ed2ab420b90d97350231c9e5d74)) | ||
| 21 | * **fetch:** add fetch, Request, Response env config variables for the adapter; ([#7003](https://github.com/axios/axios/issues/7003)) ([c959ff2](https://github.com/axios/axios/commit/c959ff29013a3bc90cde3ac7ea2d9a3f9c08974b)) | ||
| 22 | * support reviver on JSON.parse ([#5926](https://github.com/axios/axios/issues/5926)) ([2a97634](https://github.com/axios/axios/commit/2a9763426e43d996fd60d01afe63fa6e1f5b4fca)), closes [#5924](https://github.com/axios/axios/issues/5924) | ||
| 23 | * **types:** extend AxiosResponse interface to include custom headers type ([#6782](https://github.com/axios/axios/issues/6782)) ([7960d34](https://github.com/axios/axios/commit/7960d34eded2de66ffd30b4687f8da0e46c4903e)) | ||
| 24 | |||
| 25 | ### Contributors to this release | ||
| 26 | |||
| 27 | - <img src="https://avatars.githubusercontent.com/u/22686401?v=4&s=18" alt="avatar" width="18"/> [Willian Agostini](https://github.com/WillianAgostini "+132/-16760 (#7002 #5926 #6782 )") | ||
| 28 | - <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+4263/-293 (#7006 #7003 )") | ||
| 29 | - <img src="https://avatars.githubusercontent.com/u/53833811?v=4&s=18" alt="avatar" width="18"/> [khani](https://github.com/mkhani01 "+111/-15 (#6982 )") | ||
| 30 | - <img src="https://avatars.githubusercontent.com/u/7712804?v=4&s=18" alt="avatar" width="18"/> [Ameer Assadi](https://github.com/AmeerAssadi "+123/-0 (#7011 )") | ||
| 31 | - <img src="https://avatars.githubusercontent.com/u/70265727?v=4&s=18" alt="avatar" width="18"/> [Emiedonmokumo Dick-Boro](https://github.com/emiedonmokumo "+55/-35 (#6998 )") | ||
| 32 | - <img src="https://avatars.githubusercontent.com/u/47859767?v=4&s=18" alt="avatar" width="18"/> [Zeroday BYTE](https://github.com/opsysdebug "+8/-8 (#6980 )") | ||
| 33 | - <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jason Saayman](https://github.com/jasonsaayman "+7/-7 (#6985 #6985 )") | ||
| 34 | - <img src="https://avatars.githubusercontent.com/u/13010755?v=4&s=18" alt="avatar" width="18"/> [최예찬](https://github.com/HealGaren "+5/-7 (#5715 )") | ||
| 35 | - <img src="https://avatars.githubusercontent.com/u/7002604?v=4&s=18" alt="avatar" width="18"/> [Gligor Kotushevski](https://github.com/gligorkot "+3/-1 (#5627 )") | ||
| 36 | - <img src="https://avatars.githubusercontent.com/u/15893?v=4&s=18" alt="avatar" width="18"/> [Aleksandar Dimitrov](https://github.com/adimit "+2/-1 (#5595 )") | ||
| 37 | |||
| 3 | # [1.11.0](https://github.com/axios/axios/compare/v1.10.0...v1.11.0) (2025-07-22) | 38 | # [1.11.0](https://github.com/axios/axios/compare/v1.10.0...v1.11.0) (2025-07-22) |
| 4 | 39 | ||
| 5 | 40 | ||
@@ -1,13 +1,16 @@ | |||
| 1 | 1 | ||
| 2 | <h3 align="center"> 🥇 Gold sponsors <br> </h3> <table align="center" width="100%"><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://stytch.com/?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http" style="padding: 10px; display: inline-block"> <picture> <source width="200px" height="38px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/stytch_white.png"> <img width="200px" height="38px" src="https://axios-http.com/assets/sponsors/stytch.png" alt="Stytch"/> </picture> </a> <p align="center" title="API-first authentication, authorization, and fraud prevention">API-first authentication, authorization, and fraud prevention</p> <p align="center"> <a href="https://stytch.com/?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http"><b>Website</b></a> | <a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=docs-link&utm_campaign=axios-http"><b>Documentation</b></a> | <a href="https://github.com/stytchauth/stytch-node?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=node-sdk&utm_campaign=axios-http"><b>Node.js</b></a> </p> | ||
| 3 | </td><td align="center" width="33.333333333333336%"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="133px" height="43px" src="https://axios-http.com/assets/sponsors/principal.svg" alt="Principal Financial Group"/> </a> <p align="center" title="We’re bound by one common purpose: to give you the financial tools, resources and information you need to live your best life.">We’re bound by one common purpose: to give you the financial tools, resources and information you ne...</p> <p align="center"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>www.principal.com</b></a> </p> | ||
| 4 | </td><td align="center" width="33.333333333333336%"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="85px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/buy-instagram-followers-twicsy.png" alt="Buy Instagram Followers Twicsy"/> </a> <p align="center" title="Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.">Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site...</p> <p align="center"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>twicsy.com</b></a> </p> | ||
| 5 | </td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" style="padding: 10px; display: inline-block"> <picture> <source width="200px" height="52px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/descope_white.png"> <img width="200px" height="52px" src="https://axios-http.com/assets/sponsors/descope.png" alt="Descope"/> </picture> </a> <p align="center" title="Hi, we're Descope! We are building something in the authentication space for app developers and can’t wait to place it in your hands.">Hi, we're Descope! We are building something in the authentication space for app developers and...</p> <p align="center"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Website</b></a> | <a href="https://docs.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Docs</b></a> | <a href="https://www.descope.com/community?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Community</b></a> </p> | ||
| 6 | </td><td align="center" width="33.333333333333336%"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="62px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/buzzoid-buy-instagram-followers.png" alt="Buzzoid - Buy Instagram Followers"/> </a> <p align="center" title="At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world's #1 IG service since 2012.">At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rate...</p> <p align="center"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>buzzoid.com</b></a> </p> | ||
| 7 | </td><td align="center" width="33.333333333333336%"> <a href="https://www.famety.net/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/famety-buy-instagram-followers.png" alt="Famety - Buy Instagram Followers"/> </a> <p align="center" title="At Famety, you can grow your social media following quickly, safely, and easily with just a few clicks. Rated the world’s #1 social media service since 2013.">At Famety, you can grow your social media following quickly, safely, and easily with just a few clic...</p> <p align="center"> <a href="https://www.famety.net/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>www.famety.net</b></a> </p> | ||
| 8 | </td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://poprey.com/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/instagram-likes.png" alt="Poprey - Buy Instagram Likes"/> </a> <p align="center" title="Buy Instagram Likes">Buy Instagram Likes</p> <p align="center"> <a href="https://poprey.com/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>poprey.com</b></a> </p> | ||
| 9 | </td><td align="center" width="33.333333333333336%"> <a href="https://ssmarket.net/buy-youtube-subscribers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/youtube-subscribers-ssmarket.png" alt="Buy Youtube Subscribers"/> </a> <p align="center" title="SS Market offers professional social media services that rapidly increase your YouTube subscriber count, elevating your channel to a powerful position.">SS Market offers professional social media services that rapidly increase your YouTube subscriber co...</p> <p align="center"> <a href="https://ssmarket.net/buy-youtube-subscribers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>ssmarket.net</b></a> </p> | ||
| 10 | </td><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute">💜 Become a sponsor</a> | 2 | <h3 align="center"> 🥇 Gold sponsors <br> </h3> <table align="center" width="100%"><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://dev.intra-mart.jp/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="48px" height="47px" src="https://axios-http.com/assets/sponsors/opencollective/948009b39c308b39f58c5d1245abd22512adc37b.png" alt="intra-mart"/> </a> <p align="center" title="[1ページ目] CookBook の記事 intra-mart Developer Portal ">[1ページ目] CookBook の記事 intra-mart Developer Portal</p> <p align="center"> <a href="https://dev.intra-mart.jp/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>dev.intra-mart.jp</b></a> </p> |
| 3 | </td><td align="center" width="33.333333333333336%"> <a href="https://stytch.com/?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http" style="padding: 10px; display: inline-block" target="_blank"> <picture> <source width="200px" height="38px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/stytch_white.png"> <img width="200px" height="38px" src="https://axios-http.com/assets/sponsors/stytch.png" alt="Stytch"/> </picture> </a> <p align="center" title="API-first authentication, authorization, and fraud prevention">API-first authentication, authorization, and fraud prevention</p> <p align="center"> <a href="https://stytch.com/?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http" target="_blank"><b>Website</b></a> | <a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=docs-link&utm_campaign=axios-http" target="_blank"><b>Documentation</b></a> | <a href="https://github.com/stytchauth/stytch-node?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=node-sdk&utm_campaign=axios-http" target="_blank"><b>Node.js</b></a> </p> | ||
| 4 | </td><td align="center" width="33.333333333333336%"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="133px" height="43px" src="https://axios-http.com/assets/sponsors/principal.svg" alt="Principal Financial Group"/> </a> <p align="center" title="We’re bound by one common purpose: to give you the financial tools, resources and information you need to live your best life.">We’re bound by one common purpose: to give you the financial tools, resources and information you ne...</p> <p align="center"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>www.principal.com</b></a> </p> | ||
| 5 | </td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="85px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/dfa9670ad5e66eea17315332453c7f4e3a3b5905.png" alt="Buy Instagram Followers Twicsy"/> </a> <p align="center" title="Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.">Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site...</p> <p align="center"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>twicsy.com</b></a> </p> | ||
| 6 | </td><td align="center" width="33.333333333333336%"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <picture> <source width="200px" height="52px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/descope_white.png"> <img width="200px" height="52px" src="https://axios-http.com/assets/sponsors/descope.png" alt="Descope"/> </picture> </a> <p align="center" title="Hi, we're Descope! We are building something in the authentication space for app developers and can’t wait to place it in your hands.">Hi, we're Descope! We are building something in the authentication space for app developers and...</p> <p align="center"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" target="_blank"><b>Website</b></a> | <a href="https://docs.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" target="_blank"><b>Docs</b></a> | <a href="https://www.descope.com/community?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" target="_blank"><b>Community</b></a> </p> | ||
| 7 | </td><td align="center" width="33.333333333333336%"> <a href="https://route4me.com/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <picture> <source width="200px" height="51px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/route4me_white.png"> <img width="200px" height="51px" src="https://axios-http.com/assets/sponsors/route4me.png" alt="Route4Me"/> </picture> </a> <p align="center" title="Best Route Planning And Route Optimization Software">Best Route Planning And Route Optimization Software</p> <p align="center"> <a href="https://route4me.com/platform/route-optimization-software?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>Explore</b></a> | <a href="https://route4me.com/platform/marketplace/pricing?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>Free Trial</b></a> | <a href="https://route4me.com/contact?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>Contact</b></a> </p> | ||
| 8 | </td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="62px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/e1625cb54e10ee40180c99d1495a462e9d6664a4.png" alt="Buzzoid - Buy Instagram Followers"/> </a> <p align="center" title="At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world's #1 IG service since 2012.">At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rate...</p> <p align="center"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>buzzoid.com</b></a> </p> | ||
| 9 | </td><td align="center" width="33.333333333333336%"> <a href="https://www.famety.net/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/56645c65d4bad0ab84265e02430d19d64afde927.png" alt="Famety - Buy Instagram Followers"/> </a> <p align="center" title="At Famety, you can grow your social media following quickly, safely, and easily with just a few clicks. Rated the world’s #1 social media service since 2013.">At Famety, you can grow your social media following quickly, safely, and easily with just a few clic...</p> <p align="center"> <a href="https://www.famety.net/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>www.famety.net</b></a> </p> | ||
| 10 | </td><td align="center" width="33.333333333333336%"> <a href="https://poprey.com/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/e699ec99f7df3a203ddbc49d3c7712a907e628ea.png" alt="Poprey - Buy Instagram Likes"/> </a> <p align="center" title="Buy Instagram Likes">Buy Instagram Likes</p> <p align="center"> <a href="https://poprey.com/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>poprey.com</b></a> </p> | ||
| 11 | </td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://ssmarket.net/buy-youtube-subscribers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/0845614102b0c6602707ca2983de05a0098faad4.png" alt="Buy Youtube Subscribers"/> </a> <p align="center" title="SS Market offers professional social media services that rapidly increase your YouTube subscriber count, elevating your channel to a powerful position.">SS Market offers professional social media services that rapidly increase your YouTube subscriber co...</p> <p align="center"> <a href="https://ssmarket.net/buy-youtube-subscribers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>ssmarket.net</b></a> </p> | ||
| 12 | </td><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute" target="_blank" >💜 Become a sponsor</a> | ||
| 13 | </td><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute" target="_blank" >💜 Become a sponsor</a> | ||
| 11 | </td></tr></table> | 14 | </td></tr></table> |
| 12 | 15 | ||
| 13 | <!--<div>marker</div>--> | 16 | <!--<div>marker</div>--> |
@@ -1625,7 +1628,7 @@ | |||
| 1625 | 1628 | ||
| 1626 | ## Semver | 1629 | ## Semver |
| 1627 | 1630 | ||
| 1628 | Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes. | 1631 | Since Axios has reached a `v.1.0.0` we will fully embrace semver as per the spec [here](https://semver.org/) |
| 1629 | 1632 | ||
| 1630 | ## Promises | 1633 | ## Promises |
| 1631 | 1634 | ||
@@ -355,12 +355,16 @@ | |||
| 355 | insecureHTTPParser?: boolean; | 355 | insecureHTTPParser?: boolean; |
| 356 | env?: { | 356 | env?: { |
| 357 | FormData?: new (...args: any[]) => object; | 357 | FormData?: new (...args: any[]) => object; |
| 358 | fetch?: (input: URL | Request | string, init?: RequestInit) => Promise<Response>; | ||
| 359 | Request?: new (input: (RequestInfo | URL), init?: RequestInit) => Request; | ||
| 360 | Response?: new (body?: (BodyInit | null), init?: ResponseInit) => Response; | ||
| 358 | }; | 361 | }; |
| 359 | formSerializer?: FormSerializerOptions; | 362 | formSerializer?: FormSerializerOptions; |
| 360 | family?: AddressFamily; | 363 | family?: AddressFamily; |
| 361 | lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) | | 364 | lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) | |
| 362 | ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>); | 365 | ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>); |
| 363 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); | 366 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); |
| 367 | parseReviver?: (this: any, key: string, value: any) => any; | ||
| 364 | fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>; | 368 | fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>; |
| 365 | } | 369 | } |
| 366 | 370 | ||
@@ -393,11 +397,11 @@ | |||
| 393 | headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>; | 397 | headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>; |
| 394 | } | 398 | } |
| 395 | 399 | ||
| 396 | export interface AxiosResponse<T = any, D = any> { | 400 | export interface AxiosResponse<T = any, D = any, H = {}> { |
| 397 | data: T; | 401 | data: T; |
| 398 | status: number; | 402 | status: number; |
| 399 | statusText: string; | 403 | statusText: string; |
| 400 | headers: RawAxiosResponseHeaders | AxiosResponseHeaders; | 404 | headers: H & RawAxiosResponseHeaders | AxiosResponseHeaders; |
| 401 | config: InternalAxiosRequestConfig<D>; | 405 | config: InternalAxiosRequestConfig<D>; |
| 402 | request?: any; | 406 | request?: any; |
| 403 | } | 407 | } |
@@ -418,7 +422,8 @@ | |||
| 418 | isAxiosError: boolean; | 422 | isAxiosError: boolean; |
| 419 | status?: number; | 423 | status?: number; |
| 420 | toJSON: () => object; | 424 | toJSON: () => object; |
| 421 | cause?: Error; | 425 | cause?: unknown; |
| 426 | event?: BrowserProgressEvent; | ||
| 422 | static from<T = unknown, D = any>( | 427 | static from<T = unknown, D = any>( |
| 423 | error: Error | unknown, | 428 | error: Error | unknown, |
| 424 | code?: string, | 429 | code?: string, |
@@ -442,6 +447,7 @@ | |||
| 442 | } | 447 | } |
| 443 | 448 | ||
| 444 | export class CanceledError<T> extends AxiosError<T> { | 449 | export class CanceledError<T> extends AxiosError<T> { |
| 450 | readonly name: "CanceledError"; | ||
| 445 | } | 451 | } |
| 446 | 452 | ||
| 447 | export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>; | 453 | export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>; |
@@ -542,7 +548,7 @@ | |||
| 542 | 548 | ||
| 543 | export function spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R; | 549 | export function spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R; |
| 544 | 550 | ||
| 545 | export function isCancel(value: any): value is Cancel; | 551 | export function isCancel<T = any>(value: any): value is CanceledError<T>; |
| 546 | 552 | ||
| 547 | export function all<T>(values: Array<T | Promise<T>>): Promise<T[]>; | 553 | export function all<T>(values: Array<T | Promise<T>>): Promise<T[]>; |
| 548 | 554 | ||
@@ -0,0 +1,73 @@ | |
| 1 | /** |
| 2 | * Estimate decoded byte length of a data:// URL *without* allocating large buffers. |
| 3 | * - For base64: compute exact decoded size using length and padding; |
| 4 | * handle %XX at the character-count level (no string allocation). |
| 5 | * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound. |
| 6 | * |
| 7 | * @param {string} url |
| 8 | * @returns {number} |
| 9 | */ |
| 10 | export default function estimateDataURLDecodedBytes(url) { |
| 11 | if (!url || typeof url !== 'string') return 0; |
| 12 | if (!url.startsWith('data:')) return 0; |
| 13 | |
| 14 | const comma = url.indexOf(','); |
| 15 | if (comma < 0) return 0; |
| 16 | |
| 17 | const meta = url.slice(5, comma); |
| 18 | const body = url.slice(comma + 1); |
| 19 | const isBase64 = /;base64/i.test(meta); |
| 20 | |
| 21 | if (isBase64) { |
| 22 | let effectiveLen = body.length; |
| 23 | const len = body.length; // cache length |
| 24 | |
| 25 | for (let i = 0; i < len; i++) { |
| 26 | if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) { |
| 27 | const a = body.charCodeAt(i + 1); |
| 28 | const b = body.charCodeAt(i + 2); |
| 29 | const isHex = |
| 30 | ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) && |
| 31 | ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102)); |
| 32 | |
| 33 | if (isHex) { |
| 34 | effectiveLen -= 2; |
| 35 | i += 2; |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | let pad = 0; |
| 41 | let idx = len - 1; |
| 42 | |
| 43 | const tailIsPct3D = (j) => |
| 44 | j >= 2 && |
| 45 | body.charCodeAt(j - 2) === 37 && // '%' |
| 46 | body.charCodeAt(j - 1) === 51 && // '3' |
| 47 | (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd' |
| 48 | |
| 49 | if (idx >= 0) { |
| 50 | if (body.charCodeAt(idx) === 61 /* '=' */) { |
| 51 | pad++; |
| 52 | idx--; |
| 53 | } else if (tailIsPct3D(idx)) { |
| 54 | pad++; |
| 55 | idx -= 3; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | if (pad === 1 && idx >= 0) { |
| 60 | if (body.charCodeAt(idx) === 61 /* '=' */) { |
| 61 | pad++; |
| 62 | } else if (tailIsPct3D(idx)) { |
| 63 | pad++; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | const groups = Math.floor(effectiveLen / 4); |
| 68 | const bytes = groups * 3 - (pad || 0); |
| 69 | return bytes > 0 ? bytes : 0; |
| 70 | } |
| 71 | |
| 72 | return Buffer.byteLength(body, 'utf8'); |
| 73 | } |