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>
In the main readme file of axios, the icons for chrome, firefox and safari was not visible, which was giving a bit outdated vibes. I have updated all the three icons with the latest ones from "https://www.iconfinder.com/icons/23799/firefox_icon" in 48px dimension. I hope now it looks good.
Co-authored-by: Jay <jasonsaayman@gmail.com>
* 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;
* Add a group for the multiple-interceptors tests.
The current test contains a lot of details that are worth being tested
separately and also made explicit. This is what is coming with the next changes.
* Fix indentation.
* Make explicit that the test only tests the interception of the fulfilled part.
* Indent.
* Make the test just test a tiny bit, as described.
The more explicit the test, the better we can 1) describe what it does
and use that for the docs to make them understandable 2) have a better
explicit description of the API (in case we want to modify it) and 3) have
a regression test when changing.
* Add a test that explicitly shows that the order of interceptors is as they were added.
* Pull out reusable code, to make the tests more explicitly stating the things they care about.
* Write a test showing that the responses are not merged or anything,
only the last one in the chain is returned.
* Make visible that the interceptors are a chain, one receives its predecessor's data.
* Test what happens when the interceptor throws.
* Refactor, add another group of tests and pull helper function there.
The previous change to also catch in the helper function was not needed
for any of the tests above, so remove it and put it in the describe-block
below where it is needed.
Just trying to write the specific code needed, not more.
Not sure about the impact for failing tests, I am glad about input.
But the main intention here is to have minimal code, explicit tests and
not too much generic code which might break itself eventually.
* Documenting that the following reject-interceptor gets called.
* Documenting how the interceptor chain handles caught rejections.
* Document "multiple interceptors".
I just extracted the test descriptions from the new/modified tests.
And I also learned that I should improve the test descriptions, the
tests are just in a GIVEN-WHEN-THEN structure, so I can also use those
terms better. Will do this next.
* Transfer the better readable descriptions as I changed them in the README back into the tests.
After I had updated the README using the test descriptions I realized how
the test descriptions can be improved, so I did this "moving" the learnings
back into the code.
* Be a bit more explicit, it was not clear when reading, imho.
* Add new lines to be kinda consistent with the rest of the file.
Co-authored-by: Jay <jasonsaayman@gmail.com>
* chore(docs): rename Angular to AngularJS
As we all know, Angular and AngularJS are separate, and now we often say Angular refers to Angular2+.
* Update README.md
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>
* 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);
* Updating the 'Global axios defaults' README to use a safer example
The existing example usage it isn't safe in the general case as it can
lead to auth tokens being leaked to 3rd party endpoints by unexpectedly.
This change instead gives an example using
"axios.defaults.headers.common" to set the User-Agent, which is an
equally helpful use-case to document.
The 'Custom instance defaults' example just below the 'Global axios
defaults' example shows a method to set the 'Authorization' header
specific to a given API. I've also updated the variable in the 'Custom
instance defaults' code to use a semantically more relevant name within
that example.
* Revert the example instance name in response to PR request
* Reintroduce the Authorization example with a disclaimer about its usage
* Update wording nb -> important on usage comment
* Remove User-Agent example due to issues with this on Chrome and Safari
See https://github.com/axios/axios/issues/1231
Credit @chinesedfan for pointing this out
* 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
* Adding support for URLSearchParams in node
* Remove un-needed code
* Update utils.js
* Make changes as suggested
Co-authored-by: Kamil Posiadala <kamil.posiadala@codecentric.de>
Co-authored-by: Jay <jasonsaayman@gmail.com>
Small change to the data attribute doc of the config. A request body can also be set for DELETE methods but this wasn't mentioned in the documentation (it only mentioned POST, PUT and PATCH). Took my some 10-20 minutes until I realized that I don't need to manipulate the request body with transformRequest in the case of DELETE.
Co-authored-by: Jay <jasonsaayman@gmail.com>
* Made a adjustment to the documenation to clear up any ambiguity around the use of "fs". This should help clear up that the code examples with "fs" cannot be used on the client side.
Co-authored-by: Jay <jason.saayman@basebone.com>
* Adding ability to disable auto decompression
* Updating decompress documentation in README
* Fixing test\unit\adapters\http.js lint errors
* Adding test for disabling auto decompression
* Removing changes that fixed lint errors in tests
* Removing formating change to unit test
Co-authored-by: Xianming Zhong <chinesedfan@qq.com>