* 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>
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;
* Removed error when url is null as this breaks current use cases for alot of projects
* Removed associated tests that check for the for url to not be empty
* The timeoutErrorMessage property in config not work with Node.js (#3580)
* Adding "should respect the timeoutErrorMessage property" test case
Co-authored-by: Will Loo <duibu05@126.com>
* The timeoutErrorMessage property in config not work with Node.js (#3580)
* Fixing The timeoutErrorMessage property in config not work with Node.js (#3580)
* Updating http adapter
* Adding reject config.timeoutErrorMessage when setup
Co-authored-by: Will Loo <duibu05@126.com>
* Fixing The timeoutErrorMessage property in config not work with Node.js (#3580)
* Fixing The timeoutErrorMessage property in config not work with Node.js (#3580)
* Update http adapter
* Make changes as suggested after code review
Co-authored-by: Will Loo <duibu05@126.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Adding error handling inside end callback for response streams
* Updating error handling in stream end callback
* Update http.js
Co-authored-by: Jay <jasonsaayman@gmail.com>
Escaping non-special characters in strings, template literals, and regular expressions doesn't have any effect, as demonstrated in the following example:
https://eslint.org/docs/rules/no-useless-escape
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Adding request body length validation on HTTP adapter
* Removing error code assertion on HTTP's body length support test
* Removed due to the error being thrown by axios itself now, instead of follow-redirects
Co-authored-by: Jay <jasonsaayman@gmail.com>
This is not http keepalive option it is TCP level
which is lower than HTTP.
It will send meanless ack flag packet to server.
so it woudn't be drop TCP connection by server side
like Firewall, Loadbalancer, Nginx etc.
Co-authored-by: Jay <jasonsaayman@gmail.com>
update isFormdata,isArrayBuffer and isURLSearchParams, because value and Formdata(ArrayBuffer or URLSearchParams) are not the same Window sometimes.
Co-authored-by: Jay <jasonsaayman@gmail.com>
* fix/Avoid package.json import; (#4041)
* Added auto-generated config module `env/data.js` for importing package environment vars without importing the whole `package.json`;
Refactored `http.js` to use `env/data.js` instead of package.json;
* Added `env/data.js`;
Added `env/README.md`;
* Feat/export package version constant (#4065)
* Added auto-generated config module `env/data.js` for importing package environment vars without importing the whole `package.json`;
Refactored `http.js` to use `env/data.js` instead of package.json;
* Added `env/data.js`;
Added `env/README.md`;
* Export package version constant;
* Fixed cancelToken leakage; Added AbortController support; (#3305)
* Fixed cancelToken leakage;
Added AbortController support;
* Fixed typings;
* Documented `signal` option;
* Added processing of early cancellation using AbortController without sending a request;
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Updating CI to run on release branches
* Fixed default transitional config for custom Axios instance; (#4052)
Refactored `/core/mergeConfig`;
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Prepping v0.22.0 for release
* Updated date
Co-authored-by: Dmitriy Mozgovoy <robotshara@gmail.com>
I seems like the browser imposes a default timeout despite the documented default timeout being "never". When this timeout occurs, axios confusingly reports an error "timeout of 0ms exceeded". This change the message to avoid the confusing "0ms" part.
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Caseless header comparing in HTTP adapter.
It was adding User-Agent and removing Authorization, but only when
existing headers had the exact right casing. Node uses caseless logic
when managing headers.
This was causing some requests to have `User-Agent` appended to the
headers object and overriding provided agent strings.
Also included is an update to not override the `Content-Length` if it
was already defined in the options. It can be desirable to manually
specify a content length that does not match the data on hand.
Especially for testing.
* Fix eslint error
* fixup: update state UA logic
Play nice with https://github.com/axios/axios/pull/3703
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Adding HTTP status code to error.toJSON (axios#2947)
* Adding Error display div to internal server client.html
Co-authored-by: Jay <jasonsaayman@gmail.com>
Previously checking whether a response has exceeded `maxContentLength` was
quadratic with respect to the number of chunks in the response stream and
also caused unnecessary additional memory usage.
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Draft
* Added support for primitive types to be converted to JSON if the request Content-Type is 'application/json';
Added throwing SyntaxError if JSON parsing failed and responseType is json;
Added transitional option object;
Added options validator to assert transitional options;
Added transitional option `silentJSONParsing= true` for backward compatibility;
Updated README.md;
Updated typings;
* Fixed isOlderVersion helper;
Fixed typo;
Added validator.spec.js;
* Added forcedJSONParsing transitional option #2791
* `transformData` is now called in the default configuration context if the function context is not specified (for tests compatibility);
* Added `transitional.clarifyTimeoutError` to throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts;
Added support of onloadend handler if available instead of onreadystatechange;
Added xhr timeout test;
Fixed potential bug of xhr adapter with proper handling timeouts&errors (FakeXMLHTTPRequest failed to handle timeouts);
* Adding ability to omit User-Agent header
* Update line to be more compact
* Add unit tests for user-agent cases
Co-authored-by: Jay <jasonsaayman@gmail.com>
- Tests for transformResponse
- Remove eslint error by renaming the var
- Test that there data a length to avoid JSON.parse headache
- Use `util.isString()` over `typeof`
Co-authored-by: Jay <jasonsaayman@gmail.com>
- Everything still works as expected.
- Remove bundlesize
- It still uses libtorb which is deprecated and broken on Win and
requires a full suite of build tools on Mac. Keeping it in the
package makes it difficult for anyone filing issues to run tests.
- See: #3396
- Update grunt and it's plugins
- Update karma to v4...so much faster!
- Changed the karma config. Better changes: #3394
- Update Webpack
- Uses terser over uglify
- Update eslint
- Caused an error in util.js from the `global` directive so the
directive is removed (it was not needed).
- Update typescript
- The old version of tsc didn't know about new features in
@types/node (like `asserts value`).
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Fixing proxy protocol config when parsed from env vars
* Adding instructions to specify proxy protocol when setting proxy config
* Moved HTTPS proxy config instruction closer to example
* Clear https_proxy env var so as to not impact other tests