* 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>
* 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>
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>
* Update CHANGELOG.md
The mentioned pull request in the latest changelog was unrelated to the listed change. I believe this is the correct PR.
* Update CHANGELOG.md
Co-authored-by: Jay <jasonsaayman@gmail.com>