* 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
* 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>
* 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>
* 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>
* 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>
* 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>
* 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;
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>
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>
* 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.
* 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>
* The content type option is left to the developer
If the browser recognizes the fault, it can protect the developer
Although I don't think Axios itself should interfere with developers' choices
This parameter is for compatibility with historical issues
* Update xhr.js
Co-authored-by: Jay <jasonsaayman@gmail.com>