2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00
Commit Graph

131 Commits

Author SHA1 Message Date
Dmitriy Mozgovoy c959ff2901 feat(fetch): add fetch, Request, Response env config variables for the adapter; (#7003)
* feat(fetch): add fetch, Request, Response env config variables for the adapter;

* feat(fetch): fixed design issue for environments without fetch API globals;
2025-08-30 22:02:24 +03:00
khani 78b290c57c feat(adapter): surface low‑level network error details; attach original error via cause (#6982)
* feat(adapter): surface low‑level network error details; attach original error via `cause`

Node http adapter:
- Promote low-level `err.code` to `AxiosError.code`, prefixing message (e.g. `ECONNREFUSED – …`)
- Keep original error on standard `Error.cause`

XHR adapter:
- Preserve browser `ProgressEvent` on `error.event`
- Use event message when available

Tests:
- Add Node ESM tests under `test/unit/adapters` to assert `code` and `cause` behavior

Types:
- Ensure `AxiosError.cause?: unknown` and `event?: ProgressEvent` are present

* fix(adapter): use fs instead of fs/promises for sync file read in tests to fix GitHub Actions
2025-07-30 09:57:27 +02:00
Noritaka Kobayashi 6161947d9d refactor: use spread operator instead of '.apply()' (#6938)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2025-07-06 16:59:56 +02:00
Noritaka Kobayashi a1d16dd9c5 refactor: use an object spread instead of Object.assign (#6939)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2025-07-06 16:51:51 +02:00
Dmitriy Mozgovoy f7a3b5e0f7 fix(headers): fixed support for setting multiple header values from an iterated source; (#6885) 2025-04-23 19:24:08 +03:00
Dmitriy Mozgovoy 6c5d4cd692 fix(core): fix the Axios constructor implementation to treat the config argument as optional; (#6881) 2025-04-18 02:22:31 +03:00
Dmitriy Mozgovoy d4f7df4b30 fix(headers): fix getSetCookie by using 'get' method for caseless access; (#6874) 2025-04-14 22:38:27 +03:00
Dmitriy Mozgovoy 1b1f9ccdc1 fix(headers): allow iterable objects to be a data source for the set method; (#6873) 2025-04-14 21:55:27 +03:00
Willian Agostini 80ea756e72 feat(AxiosHeaders): add getSetCookie method to retrieve set-cookie headers values (#5707)
* feat(AxiosHeaders): add getSetCookie method to retrieve set-cookie header values

* refactor(AxiosHeaders.js): use logical OR instead of nullish coalescing operator in getSetCookie method

---------

Co-authored-by: Willian Agostini <willian.agostini@gmail.com.br>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2025-03-25 21:30:23 +02:00
Marc Hassan f10c2e0de7 fix(buildFullPath): handle allowAbsoluteUrls: false without baseURL (#6833)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2025-03-18 20:01:37 +02:00
Michael Toscano 32c7bcc0f2 feat: Add config for ignoring absolute URLs (#5902) (#6192)
* fix: prevent request url override

prevent request URL from overriding preconfigured base URL

BREAKING CHANGE: code relying on the above will now combine the URLs instead of prefer request URL

* feat: add config option for allowing absolute URLs

* fix: add default value for allowAbsoluteUrls in buildFullPath

* fix: typo in flow control when setting allowAbsoluteUrls

* feat: update tests supporting issue #5902 functionality

* feat: update README.md with allowAbsoluteUrls

* fix: properly group conditions in buildFullPath.js to avoid undefined error when baseUrl undefined

* Update README.md fix typo

* fix: update build full path logic to address failing test case

* fix: update base URL test

* fix: remove problem test (works locally, will not work in the pipeline)

* fix: update https test to use github.com instead of google.com

* fix: revert previous commit

* fix: add back problem test

* chore: remove un-needed passed var to URL class instanciation

---------

Co-authored-by: Austin Ryan Lawson <ryan.lawson2@gmail.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2025-02-12 11:09:24 +02:00
Akki 5d99fe4491 fix(core): fixed config merging bug (#6668)
Co-authored-by: rana-aakash <aakash.rana@rooter.io>
Co-authored-by: Dmitriy Mozgovoy <robotshara@gmail.com>
2024-10-30 23:39:55 +02:00
Ell Bradshaw 8f3cde11d2 Warn about common option misspellings (#6489)
* chore(tests): add failing tests for baseUrl

* chore(tests): simplify to just warning

* feat: warn about likely-misspelled options

* chore: add semi-colon

* chore: add missing semi-colons

---------

Co-authored-by: Ell Bradshaw <ell@c9a.co>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2024-09-26 21:31:24 +02:00
Kenzo Wada 763895270f fix: ios11 breaks when build (#6608)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2024-09-26 19:28:35 +02:00
Dmitriy Mozgovoy 6700a8adac fix(core): add the missed implementation of AxiosError#status property; (#6573) 2024-08-23 15:58:38 +03:00
Alexandre ABRIOUX 81e0455b7b fix(core/axios): handle un-writable error stack (#6362)
Co-authored-by: Dmitriy Mozgovoy <robotshara@gmail.com>
2024-05-07 20:57:03 +03:00
Dmitriy Mozgovoy a3ff99b59d feat(adapter): add fetch adapter; (#6371) 2024-04-28 22:33:49 +03:00
Miroslav Petrov 2656612bc1 fix(AxiosHeaders): fix AxiosHeaders conversion to an object during config merging (#6243)
Co-authored-by: Dmitriy Mozgovoy <robotshara@gmail.com>
2024-03-15 18:10:18 +02:00
Dmitriy Mozgovoy 1a08f90f40 fix: capture async stack only for rejections with native error objects; (#6203) 2024-01-25 20:42:38 +02:00
Ilya Priven 123f354b92 fix: wrap errors to improve async stack trace (#5987) 2024-01-25 00:21:12 +02:00
Dmitriy Mozgovoy cff996779b feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old withCredentials behavior; (#6046) 2023-11-14 15:38:25 +02:00
Dmitriy Mozgovoy 8fda2766b1 fix(headers): fixed common Content-Type header merging; (#5832) 2023-08-26 16:26:50 +03:00
Dmitriy Mozgovoy d8b4ca0ea5 fix(headers): added support for setting header names that overlap with class methods; (#5831) 2023-08-25 21:07:51 +03:00
Dmitriy Mozgovoy e6f7053bf1 perf(merge-config): optimize mergeConfig performance by avoiding duplicate key visits; (#5679) 2023-04-26 00:34:46 +03:00
Dmitriy Mozgovoy a56c866120 fix(params): re-added the ability to set the function as paramsSerializer config; (#5633) 2023-04-05 19:44:36 +03:00
Dmitriy Mozgovoy e7decef6a9 fix(headers): fixed isValidHeaderName to support full list of allowed characters; (#5584) 2023-03-19 15:30:51 +02:00
Dmitriy Mozgovoy ea87ebfe6d fix(headers): fixed the filtering logic of the clear method; (#5542) 2023-02-11 16:31:03 +02:00
Dmitriy Mozgovoy 96d336f527 fix(formdata): add hotfix to use the asynchronous API to compute the content-length header value; (#5521) 2023-02-02 00:55:05 +02:00
Dmitriy Mozgovoy 9915635c69 fix(headers): fixed & optimized clear method; (#5507) 2023-01-31 00:35:06 +02:00
Dmitriy Mozgovoy 342c0ba9a1 fix(headers): added missed Authorization accessor; (#5502) 2023-01-27 02:01:36 +02:00
Arthur Fiorette cac6cfa6f6 fix: include config on new CancelledError (#4922)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-11-25 15:46:49 +02:00
Dmitriy Mozgovoy d032edda08 Refactored adapters loader; (#5277)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-11-22 20:53:56 +02:00
Dmitriy Mozgovoy b7ee49f637 Added toJSONObject util; (#5247)
Fixed AxiosError.toJSON method to avoid circular references;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-11-22 20:44:24 +02:00
Dmitriy Mozgovoy ab77a40e1c Fixed & Imporoved AxiosHeaders class (#5224)
* Refactored AxiosHeaders class;

* Added support for instances of AxiosHeaders as a value for the headers option;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-11-07 21:11:42 +02:00
Dmitriy Mozgovoy 9d4b016dde feat: added custom params serializer support; (#5113)
* Added custom params serializer support;

* Added missed semicolon;
Fixed allowUnknown option;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-10-13 22:12:10 +02:00
Dmitriy Mozgovoy 110ae9ae61 fix: handling of array values for AxiosHeaders (#5085)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-10-13 21:11:01 +02:00
Dmitriy Mozgovoy bdf493cf8b Axios ES2017 (#4787)
* Added AxiosHeaders class;

* Fixed README.md href;

* Fixed a potential bug with headers normalization;

* Fixed a potential bug with headers normalization;
Refactored accessor building routine;
Refactored default transforms;
Removed `normalizeHeaderName` helper;

* Added `Content-Length` accessor;
Added missed `has` accessor to TS types;

* Added `AxiosTransformStream` class;
Added progress capturing ability for node.js environment;
Added `maxRate` option to limit the data rate in node.js environment;
Refactored event handled by `onUploadProgress` && `onDownloadProgress` listeners in browser environment;
Added progress & data rate tests for the http adapter;
Added response stream aborting test;
Added a manual progress capture test for the browser;
Updated TS types;
Added TS tests;
Refactored request abort logic for the http adapter;
Added ability to abort the response stream;

* Remove `stream/promises` & `timers/promises` modules usage in tests;

* Use `abortcontroller-polyfill`;

* Fixed AxiosTransformStream dead-lock in legacy node versions;
Fixed CancelError emitting in streams;

* Reworked AxiosTransformStream internal logic to optimize memory consumption;
Added throwing an error if the request stream was silently destroying (without error) Refers to #3966;

* Treat the destruction of the request stream as a cancellation of the request;
Fixed tests;

* Emit `progress` event in the next tick;

* Initial refactoring;

* Refactored Mocha tests to use ESM;

* Refactored Karma tests to use rollup preprocessor & ESM;
Replaced grunt with gulp;
Improved dev scripts;
Added Babel for rollup build;

* Added default commonjs package export for Node build;
Added automatic contributors list generator for package.json;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-06-18 11:19:27 +02:00
Jay b80c7d3844 docs(core/Axios) 2022-06-02 20:55:27 +02:00
Jay c4c30b22d6 docs(core/AxiosError) 2022-06-02 20:54:47 +02:00
Jay fb8efb9a70 docs(core/InterceptorManager) 2022-06-02 20:54:24 +02:00
Jay 81c0b3568f docs(core/buildFullPath) 2022-06-02 20:53:57 +02:00
Jay 4f4c1d3be9 docs(core/dispatchRequest) 2022-06-02 20:53:31 +02:00
Jay 722640aeda docs(core/mergeConfig) 2022-06-02 20:53:07 +02:00
Jay 6e0aff9407 docs(core/settle) 2022-06-02 20:52:44 +02:00
Jay e9bd1626ff docs(core/transformData) 2022-06-02 20:52:22 +02:00
João Gabriel Quaresma 1504792765 Fixing content-type header repeated (#4745)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-28 11:52:50 +02:00
Dmitriy Mozgovoy c008e57fe4 Added axios.formToJSON method; (#4735)
* Draft

* Added `formDataToJSON` helper;
Added `axios.formToJSON` method;
Added client tests;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-25 08:21:40 +02:00
Dmitriy Mozgovoy c30252f685 Added data URL support for node.js; (#4725)
* Added data URL support for node.js;
Added missed data URL protocol for the browser environment;
Optimized JSON parsing in the default response transformer;
Refactored project structure;
Added `cause` prop for AxiosError instance that refers to the original error if it was wrapped with `AxiosError.from` method;
Added fromDataURI helper;
Added test for handling data:url as an `arraybuffer|text|stream`;

* Added throwing of 405 HTTP error if the method is not GET;
2022-05-20 08:04:36 +02:00
Dmitriy Mozgovoy d60d6844b1 Fixed AxiosError stack capturing; (#4718)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-16 08:58:47 +02:00
Koki Oyatsu 2f50c8249b Adding HTTP status code for transformResponse (#4580)
* Adding HTTP status code for transformResponse

* refs #1214

* Fix wrong argument for tranformResponse

* Fix test wrong argument for tranformData

* Add test case for transformData

* Add test case for transformData (reference headers case)

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 19:25:16 +02:00