Commit Graph

306 Commits

Author SHA1 Message Date
Jason Saayman
24c45391b6
fix: backport the fixes from the v1 branch 2026-04-10 21:17:29 +02:00
Jay
16ae9508dd
refactor: update ci for v0.x (#7407)
* refactor: rennovate ci

* chore: improve publish

* chore: lock dts

* chore: do ci install

* fix: tests

* chore: remove husky

* chore: clarify versioning scheme

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: feedback

* chore: small fix to publish yml

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-17 21:10:51 +02:00
Felix Bernhard
d7ff1409c6
fix: backport DOS via __proto__ key in merge config fix to v0.x (#7388)
* backport fix

* add unit tests

* use `require()` instead of `import`
2026-02-11 08:19:32 +02:00
Felix Bernhard
a1b1d3f073
fix: backport maxContentLength vulnerability fix to v0.x (#7034)
* backport `maxContentLength` check for `data:` protocol urls

* backport test for `estimateDataURLDecodedBytes`

* use CommonJS export

* use `var` instead of `const`

* replace `let` with `var`

* use standard function instead of arrow function
2025-09-16 16:21:06 +02:00
Gabe Mendoza
02c3c69ced
fix: backport allowAbsoluteUrls vuln fix to v0.x (#6829)
* allowAbsoluteUrls

* fix logic - copied from v1.x

* update string

* undo changes to dist/axios.js

* chore: use strict equal in lib/core/buildFullPath.js

---------

Co-authored-by: Jay <jasonsaayman@gmail.com>
2025-03-19 12:24:25 +02:00
nishimori daisuke
0630c329f7
fix: modify log while request is aborted (#4917)
* fix: modify log while request is aborted

since the previous log 'maxContentLength size of {maxContentLength} exceeded' does not represent an acutual error, I just modified the sentence.

* fix: change error kind

* fix: fix test about stream aborted pattern

---------

Co-authored-by: Jay <jasonsaayman@gmail.com>
2024-12-05 21:20:49 +02:00
qiongshusheng
4840cb2bd0
fix: regular expression denial of service issues (#6708)
* fix: Regular Expression Denial of Service (ReDoS)

* fix test failed
2024-11-15 09:29:49 +02:00
Sol Zhu
2e36cdb67f
fix(backport): fix paramsSerializer function validation (#6361)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2024-05-24 18:44:36 +02:00
Peter Williamson
3936f44b1a
Fix: omit nulls in params (#6394)
* fix: omit nulls when building params

* chore: fix prettier formatting

* fix: omit nulls when building params pt 2

---------

Co-authored-by: Jay <jasonsaayman@gmail.com>
2024-05-24 18:41:46 +02:00
Sean Powell
146848f3e4
fix: backported commit #6167 and #6163 (#6402) 2024-05-24 18:38:36 +02:00
briwa
111811eadc
fix(backport): custom params serializer support (#6263) 2024-03-28 18:54:20 +02:00
lnjbr
2755df562b
fix(security): fixed CVE-2023-45857 by backporting withXSRFToken option to v0.x (#6091) 2024-01-19 18:33:41 +02:00
Willian Agostini
c4bf0a4afc
Allow null indexes on formSerializer and paramsSerializer v0.x (#4961)
* test: Failed test

Param indexes from formSerializer and paramsSerializer receiving null

Closes #4959

* fix: Allow null to indexes in SerializerOptions

Closes #4959

Co-authored-by: Willian Agostini <willian.agostini@fleetcor.com.br>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-29 08:19:45 +02:00
Willian Agostini
1e2679f75b
fix: [Types] Type of header in AxiosRequestConfig / for Axios.create is incorrect (#4927)
* test: Fail test to #4911

Type of header in AxiosRequestConfig / for Axios.create is incorrect

* fix: Type of header in AxiosRequestConfig is incorrect

Add new type for MethodsHeaders in AxiosRequestHeaders

Closes #4911

* refactor: Remove interface to add type #4927

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-28 21:05:07 +02:00
Willian Agostini
80b546c3f1
fix: loosing request header (#4858) (#4871)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-09-26 21:05:57 +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
Victor Augusto
a11f9501b8
Fix/4737/timeout error message for http (#4738)
* Fixing timeoutErrorMessage in http calls

When timeoutErrorMessage was set this did not change anything in the error message, with this change the error message will be the configured message

* Testing timeoutErrorMessage in http calls

When timeoutErrorMessage was set this did not change anything in the error message, with this change the error message will be the configured message

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-28 11:46:33 +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
934f390cc3
URL params serializer; (#4734)
* Refactored BuildURL helper to use URLSearchParams serializer;

* Updated typings;
Added TS test;
2022-05-25 08:16:38 +02:00
Dmitriy Mozgovoy
467025bdb7
Fixed bug #4727 : toFormData Blob issue on node>v17; (#4728)
* Fixed bug #4727;
Added node 18.x to the CI;
Added hotfix for `ERR_OSSL_EVP_UNSUPPORTED` issue with karma running on node >=17.x;
Added `cross-env` to allow running build and test scripts on Windows platforms;

* Added conditional setting of `--openssl-legacy-provider` option for node versions >=17.x;

* Refactored ssl-hotfix & test script;

* Fixed and refactored default max body length test due to ECONNRESET failure;

* Added test for converting the data uri to a Blob;
Fixed bug with parsing mime type for Blob;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-20 16:31:26 +02:00
Dimitris Halatsis
e9c9f3392b
Fix/4263/maxbodylength defaults (#4731)
* test(http): add test case for default body length in follow-redirects

* fix(http): provide proper default body length to follow-redirects

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-20 08:27:37 +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
bd391247b4
Added the ability for the url-encoded-form serializer to respect the formSerializer config; (#4721)
Added test for `formSerializer` config in context of `url-encoded-form` serializer;
2022-05-17 08:26:35 +02:00
Dmitriy Mozgovoy
c05ad48952
Fixed toFormData regression bug (unreleased) with Array-like objects serialization; (#4714)
Added `toURLEncodedForm` helper;
Added automatic payload serialization to `application/x-www-form-urlencoded` to have parity with `multipart/form-data`;
Added test of handling `application/x-www-form-urlencoded` body by express.js;
Updated README.md;
Added missed param in JSDoc;
Fixed hrefs in README.md;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-16 08:30:17 +02:00
Maxime Bargiel
24f22b2b0b
Fixing proxy beforeRedirect regression (#4708) 2022-05-16 08:05:56 +02:00
Dmitriy Mozgovoy
807918bda2
Added enhanced toFormData implementation with additional options support; (#4704)
Updated default notation for arrays and objects to bracket style;
Added `multer/express.js` tests;
Updated README.md;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-11 19:30:08 +02:00
Maxime Bargiel
495d5fb133
Resolving proxy from env on redirect (#4436)
* Fixing http adapter to recompute proxy on redirect

Redirections can target different hosts or change the protocol
from http to https or vice versa. When the proxy option is
inferred from the environment, it should be recomputed when
the protocol or host changes because the proxy host can differ
or even whether to proxy or not can differ.

* Fixing proxy protocol handling

1) setProxy now changes request options protocol when using a proxy with explicit protocol.
2) As a result, selection of the correct transport can be simplified.
3) Legacy agent selection needs to be moved done accordingly. (Is 'agent' option even still used?)

* Using proxy-from-env library to handle proxy env vars

The proxy-from-env library is a popular, lightweight library that is
very easy to use and covers a few more cases, not to mention it has
extensive test coverage.

* Fixing proxy auth handling

* Adding test proving env vars are re-resolved on redirect

* Revert unnecessary change

* Fixing proxy beforeRedirect regression

* Fixing lint errors

* Revert "Fixing lint errors"

This reverts commit 2de3cabc60.

* Revert "Fixing proxy beforeRedirect regression"

This reverts commit 57befc3215.
2022-05-11 19:24:14 +02:00
Lukas Hroch
ac96144dd3
fix(types): allow to specify partial default headers for instance creation (#4185)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 20:03:05 +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
Spencer
9f6ba5ee43
Fixing instance.defaults.headers type (#4557)
* Fixing instance.defaults.headers type

* remove console.log()

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 19:12:53 +02:00
Dmitriy Mozgovoy
de48c5d626
Fixed race condition on immediate requests cancellation (#4261)
* Fixes #4260: fixed race condition on immediate requests cancellation

* Update http.js

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 18:12:29 +02:00
Landro3
544cf134f3
Interceptor clear (#4248)
* Adding interceptor clearing

* Fixing spacing

* changed clear to empty array

* fixed interceptor clear test

Co-authored-by: Andrew <Andrew@Andrews-MacBook-Pro.local>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-05 21:31:06 +02:00
Dmitriy Mozgovoy
384b7e6994
Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill (#4229)
* Added generic `AxiosAbortSignal` TS interface to avoid importing AbortController polyfill;

* Renamed `AxiosAbortSignal` to `GenericAbortSignal` to use the same naming style as `GenericFormData`;

* Added TS test for `GenericAbortSignal` interface;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 21:23:01 +02:00
Maxime Bargiel
9ca2779d7a
Fixing http tests to avoid hanging when assertions fail (#4435)
* Fixing cases of Axios hanging on test failures

* Fix max redirect assertion

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 17:54:14 +02:00
Dmitriy Mozgovoy
c07998a621
Added generic TS types for the exposed toFormData helper; (#4668) 2022-05-03 20:29:50 +02:00
Des Preston
7920d11144
Updating AxiosError to include stack trace (#4624)
Related to discussions here https://github.com/axios/axios/issues/2387

Attempt to capture the stack trace at the time the error is created in
order to maintain context about where the error originates from.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 18:46:10 +02:00
Dmitriy Mozgovoy
b9e9fb4fa0
Enhanced protocol parsing implementation to fix #4633; (#4639)
Added unit tests;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-04-27 11:30:50 +02:00
Dmitriy Mozgovoy
76432c18be
Fixed FormData posting in browser environment by reverting #3785; (#4640)
* Fixed posting FormData in browser environment by reverting #3785;

* Added ability to keep `Content-Type` header in non-standard browser environments;

* Added browser test of FormData posting using external HTTP service (https://httpbin.org/post);

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-04-27 11:26:52 +02:00
Dmitriy Mozgovoy
4f7e3e3a7a
Removed import of url module in browser build due to significant size overhead; (#4594)
Removed pointless `Malformed URL` checking in  client build;
2022-04-26 09:08:49 +02:00
Jay
8699891b8e Fixed merge conflicts 2022-04-01 18:40:12 +02:00
Dmitriy Mozgovoy
6b9b05b907
Improved FormData support; (#4448)
* Fixed isFormData predicate;
Added support for automatic object serialization to FormData if `Content-Type` is `multipart/form-data`;
Added support for FormData to be overloaded using `config.env.FormData` option;
Added support for FormData in node.js environment through `form-data` package;

* Added the `form-data` package as a dependency for the server build;
Added tests for FormData payload;

* Added FormData automatic serialization section;
Refactored cancellation section;

* Reworked toFormData helper;
Expose toFormData helper as a static method;
Refactored transform request;
Added kindOf, kindOfTest, endsWith, isTypedArray util;
Refactored utils.js to use kindOf for tests;

* Fixed isFormData predicate; (#4413)

Added support for automatic object serialization to FormData if `Content-Type` is `multipart/form-data`;
Added support for FormData to be overloaded using `config.env.FormData` option;
Added support for FormData in node.js environment using `form-data` package;

(cherry picked from commit 73e3bdb883)

* Added shortcut methods `postForm`, `putForm`, `patchForm` to submit a Form;
Added ability to submit FileList object as a FormData;
Updated README.md;

* Updated README.md;
2022-03-14 20:22:10 +02:00
Jay
e52e4dbb57 Fixed errors when running tests 2022-03-10 21:25:55 +02:00
Jay
340ad9ec8c Fixed merge conflict 2022-03-09 19:57:04 +02:00
Jay
d8d43c1ffd Mended merge conflicts 2022-03-09 19:41:56 +02:00
sakarit
bdb7d76d40
Adding baseURL to be used in getUri(), also removing question mark trimming since there seems to be no obvious reason for it. (#3737)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-07 20:09:23 +02:00
João Gabriel Quaresma
195c8e5ff5
Returned error treated when requesting uncommon URL (#3544)
* Fixing error returned when requesting illegal URL

* Adding unit tests http.js

* Fixing error message axios invalid request from browser

* Adding unit tests requests.spec.js

* Adding at utils.js a new method: getProtocol

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-07 19:53:57 +02:00
Zoran Kokeza
412d3bd607
Adding support for beforeRedirect config option (#3852)
* Adding support for beforeRedirect config option

* Adding tests for beforeRedirect

* Update README.md

Co-authored-by: Prabodh Meshram <prabodh.meshram7@gmail.com>

* fix types

Co-authored-by: Prabodh Meshram <prabodh.meshram7@gmail.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-07 19:46:08 +02:00
Dmitriy Mozgovoy
170588f3d7
Refactored project file structure to avoid circular imports; (#4220)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-07 09:09:43 +02:00
Jay
d660e29c1a
Revert "Fixed isFormData predicate; (#4413)" (#4472)
This reverts commit 73e3bdb883.
2022-02-13 15:47:38 +02:00
Dmitriy Mozgovoy
73e3bdb883
Fixed isFormData predicate; (#4413)
Added support for automatic object serialization to FormData if `Content-Type` is `multipart/form-data`;
Added support for FormData to be overloaded using `config.env.FormData` option;
Added support for FormData in node.js environment through `form-data` package;
2022-02-02 13:48:44 +02:00