Commit Graph

204 Commits

Author SHA1 Message Date
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
Nicholas Juntilla
3d13b67c56
Fix FormData example (#4391)
You need to have form.getBuffer() in order for the FormData library to submit from node.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-07 09:45:12 +02:00
Tomás Raiti
45cb5ad716
Updated README example to be coherent with the CommonJS usage (#4418)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-03-07 09:35:48 +02:00
CookieMr
c5bdbd436d Update follow-redirects dependency due to Vurnerbility
Previous version of follow-redirects dependency is reported
by Snyk to have a vurnerbility.
https://app.snyk.io/test/npm/follow-redirects/1.14.7
2022-02-11 14:58:12 +01:00
Wolfram Kriesing
e6aef5a1c4
(Add tests to) document how multiple inceptors work (#3564)
* 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>
2021-12-22 21:14:52 +02:00
HyperLifelll9
20e8b6bc8c
chore(docs): rename Angular to AngularJS (#4114)
* 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>
2021-10-12 10:06:11 +02:00
Jay
76f09afc03
Release/v0.22.0 (#4107)
* 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>
2021-10-01 08:02:13 +02:00
Jay
4091b075f6
Release/0.21.4 (#4025)
* fix json transform when data is pre-stringified (#4020)

* [Updating] incorrect JSON syntax in README.md

* [Releasing] v0.21.4

Co-authored-by: Guillaume FORTAINE <guillaume+github@fortaine.com>
2021-09-06 17:35:06 +02:00
Fabiel Leon
b5a1a67b3c
Adding nodejs http.request option: insecureHTTPParser (#2930)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-05 13:43:49 +02:00
Sam Carlton
e10a0270e9
Fix README typo under Request Config (#3825)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-08-13 14:55:00 +02:00
Mo Sattler
e091491127
Update README.md (#3936)
Fixing the example JSON of `Request Config`

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-08-13 14:45:46 +02:00
Jay
b42fbad57b
Removed un-needed bracket
Removed un-needed bracket
2021-08-13 14:36:02 +02:00
Jay
520c8dccde
Updating CI status badge (#3953)
Updated CI status badge to show Github workflow status
2021-08-13 14:35:20 +02:00
Jay
3958e9fbc8
Add explanation of cancel token (#3803)
Thanks to @socketpair for testing and checking this.
2021-05-18 09:08:20 +02:00
Johannes Jarbratt
94fc4ea716
Adding isAxiosError typeguard documentation (#3767)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-05-04 20:05:05 +02:00
Dmitriy Mozgovoy
5ad6994da3
JSON improvements: throw if JSON parsing failed; number, boolean can be passed directly as payload for encoding to JSON #2613, #61, #907 (#3688)
* 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);
2021-04-19 18:55:34 +02:00
Jay
c0317b7453
Update README.md (#3707) 2021-03-29 16:43:29 +02:00
Sasha Korotkov
62d6256039
issue#2609 | Sasha | predictable axios requests (#2702)
* issue#2609 | Sasha | predictable axios requests

- axios requests are not delayed by pre-emptive promise creation by default
- add options to interceptors api ("synchronous" and "runWhen")
- add documentation and unit tests

* issue#2609 | Sasha | pull request feedback changes

* issue#2609 | Sasha | additional feedback changes

* issue#2609 | Sasha | put back try/catch

* issue#2609 | Sasha | add 2 adapter unit tests

- remove check for requestCancelled

Co-authored-by: ak71845 <alexandre.korotkov@kroger.com>
Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-03-01 11:11:35 +02:00
Nisar Hassan Naqvi
535d0c45c1
move the mention of gitpod to the main readme + modify gitpod description. (#2637)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-02-17 08:28:00 +02:00
Ali Clark
fe52a611ef
Default headers example AUTH_TOKEN comment (#3539)
* 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
2021-01-12 16:52:42 +02:00
Jonathan Foster
e426910be7
Protocol not parsed when setting proxy config from env vars (#3070)
* 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
2020-12-03 09:36:50 +02:00
Kamil Posiadała
c4300a88cf
Adding support for URLSearchParams in node (#1900)
* 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>
2020-06-25 19:06:00 +02:00
Frostack
bed6783452
add table of content (preview) (#3050)
* add toc (preview)

* remove toc in toc

Signed-off-by: Moni <usmoni@gmail.com>

* fix sublinks

* fix indentation

* remove redundant table links

* update caps and indent

* remove axios

Co-authored-by: Moni <usmoni@gmail.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-06-25 18:41:10 +02:00
jeffjing
ee46dff3ef
docs(): Detailed config options environment. (#2088)
* docs(): Detailed config options environment.

* Update README.md

Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-05-29 19:08:27 +02:00
Taegyeoung Oh
d35b5b5902
Remove axios.all() and axios.spread() from Readme.md (#2727)
* Updating Readme.md
- remove axios.all(), axios.spread()

* Updating Readme.md
- replace example
- axios.all() -> Promise.all()
- axios.spread(function (acct, perms)) -> function (acct, perms)
- add deprecated mark

* Update README.md

Make changes after review

Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-05-27 19:43:08 +02:00
marcinx
6d36dbe7b7
Update README.md (#2887)
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>
2020-05-27 19:26:13 +02:00
Samina Fu
021e741aa1
Add CDNJS version badge in README.md (#878)
This badge will show the version on CDNJS!

Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-05-22 16:09:09 +02:00
Jay
fd57956a7e
Documentation update to clear up ambiguity in code examples (#2928)
* 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>
2020-05-05 13:44:07 +02:00
hexaez
16b5718954
Update README.md about validateStatus (#2912)
Rewrote the comment from "Reject only if the status code is greater than or equal to 500" to "Resolve only if the status code is less than 500"
2020-04-22 15:59:26 +02:00
Remco Haszing
5e0fb5fc99
Updating documentation for usage form-data (#2805)
Closes #2049

Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
2020-04-05 18:01:38 +08:00
Spencer von der Ohe
42eb9dfabc
Adding option to disable automatic decompression (#2661)
* 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>
2020-03-06 22:01:58 +08:00
Gustavo López
6642ca9aa1
Add independent maxBodyLength option (#2781)
* Add independent option to set the maximum size of the request body

* Remove maxBodyLength check

* Update README

* Assert for error code and message
2020-03-06 21:55:19 +08:00
Alexandru Ungureanu
67e560da10
Added Response header access instructions (#1901)
* Added Response header access instructions

* Added note about using bracket notation
2020-02-26 19:03:20 +08:00
Ian Wijma
b139abfc36
Add onUploadProgress and onDownloadProgress are browser only (#2763)
Saw in #928 and #1966 that `onUploadProgress` and `onDownloadProgress` only work in the browser and was missing that from the README.

Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
2020-02-26 10:28:49 +08:00
Jimmy Liao
3d6cafb3f7
Update ' sign to ` in proxy spec (#2778) 2020-02-25 23:05:51 +08:00
Lukas Drgon
2cf6ae4608
Adding jsDelivr link in README (#1110)
* Adding jsDelivr link

* Add SRI

* Remove SRI

Co-authored-by: Yasu Flores <carlosyasu91@gmail.com>
Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
2020-02-15 20:48:16 +08:00
Xianming Zhong
7df84a7ff7 Revert finally as then (#2683)
Co-authored-by: Yasu Flores <carlosyasu91@gmail.com>
2020-01-22 12:18:22 -08:00
Yasu Flores
0cc22c2f42
Fix badge, use master branch (#2538) 2019-11-15 19:32:37 -08:00
Harshit Singh
fa68fd30c3 Update README.md (#2504) 2019-11-03 18:30:49 -08:00
Yasu Flores
ccca5e0e21 Add error toJSON example (#2466) 2019-10-15 22:20:56 -03:00
Maskedman99
4f189ec80c Add license badge (#2446)
MIT License badge added in README.md file
2019-10-04 15:47:49 +02:00
Jihwan Oh
88dbb82d77 Fix word 'sintaxe' to 'syntax' in README.md (#2432)
- translate 'sintaxe' word from portuguese to english
2019-09-25 21:18:44 -03:00
Ahmed Tarek
d74385f1c8 🐛Fix request finally documentation in README (#2189) 2019-09-13 10:19:43 -03:00
Vamp
e3a7116f14 upadating README: notes on CommonJS autocomplete (#2256)
closes #2226. add note on how to gain typings / autocomplete / intellisense when using CommonJS (`require()`) imports
2019-09-13 09:28:14 -03:00
Lucas
488a4598a3 Sintaxe alternative to send data into the body (#2317) 2019-09-13 09:19:16 -03:00
James George
f7e2a995d6 docs: minor tweak (#2404)
made the license section link up to the respective file.
2019-09-13 09:10:55 -03:00
Sagar Acharya
f5704fce71 Update response interceptor docs (#2399) 2019-09-12 22:30:36 -03:00
Avindra Goolcharan
6a4a85c57f Doc fixes, minor examples cleanup (#2198)
* README.md COOKBOOK.md: minor fixes

 * simplify language

* ECOSYSTEM: create a few categories

* Examples: log port listening to

* upgrade bootstrap 3 -> 4 in examples

bootstrap 4 is slightly smaller then 3.2.0
so it should also help load examples faster

* categorize 0.19 items a little differently

surface user/consumer changes first
2019-09-07 09:05:26 -03:00
Michael Foss
b9931e0a95 Fix grammar in README.md (#2271) 2019-09-06 12:42:10 -03:00
Denis Sikuler
f0f68afb61 Fix a typo in README (#2384) 2019-09-06 09:55:06 -03:00