2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-30 15:24:11 +03:00
Commit Graph

1184 Commits

Author SHA1 Message Date
Maxime Bargiel 495d5fb133 Resolving proxy from env on redirect (#4436)
* 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 2de3cabc60db2444e63a699bae9ec45531218a84.

* Revert "Fixing proxy beforeRedirect regression"

This reverts commit 57befc3215980e47333fedc1e9028cc22297540b.
2022-05-11 19:24:14 +02:00
Jay de5e006142 Revert "The content type option is left to the developer (#4550)" (#4699)
This reverts commit 9579bad1d3.
2022-05-09 20:16:21 +02:00
Lukas Hroch ac96144dd3 fix(types): allow to specify partial default headers for instance creation (#4185)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 20:03:05 +02:00
Dmitriy Mozgovoy 356b166182 Added blob to the list of protocols supported by the browser; (#4678)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 19:27:18 +02:00
Koki Oyatsu 2f50c8249b Adding HTTP status code for transformResponse (#4580)
* 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>
2022-05-09 19:25:16 +02:00
Lawliet 9579bad1d3 The content type option is left to the developer (#4550)
* 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>
2022-05-09 19:20:33 +02:00
Spencer 9f6ba5ee43 Fixing instance.defaults.headers type (#4557)
* Fixing instance.defaults.headers type

* remove console.log()

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 19:12:53 +02:00
暴走老七 4c898f8665 don\'t need to transform arguments to array (#4544)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 19:08:57 +02:00
Dave 6bd1a89657 docs(ECOSYSTEM): add react hook plugin (#4319)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 18:33:50 +02:00
Dmitriy Mozgovoy de48c5d626 Fixed race condition on immediate requests cancellation (#4261)
* Fixes #4260: fixed race condition on immediate requests cancellation

* Update http.js

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-09 18:12:29 +02:00
Jay 27280ec260 Removing the issue template enforcement as many people are complaining and multiple issue are just being closed even when valid 2022-05-09 18:02:16 +02:00
Jamie Slome 8d26147ae0 Update SECURITY.md (#4687) 2022-05-06 13:50:09 +02:00
Landro3 544cf134f3 Interceptor clear (#4248)
* Adding interceptor clearing

* Fixing spacing

* changed clear to empty array

* fixed interceptor clear test

Co-authored-by: Andrew <Andrew@Andrews-MacBook-Pro.local>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-05 21:31:06 +02:00
rafw87 743b4a8b8f Add axios-url-template to Ecosystem (#4238)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-05 21:08:05 +02:00
Afzal Sayed 7e56f8653c Fix grammatical issues in README (#4232)
* Fix grammatical issues in README

* Fix typo in COLLABORATOR_GUIDE.md

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-05 21:02:32 +02:00
Dmitriy Mozgovoy 384b7e6994 Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill (#4229)
* Added generic `AxiosAbortSignal` TS interface to avoid importing AbortController polyfill;

* Renamed `AxiosAbortSignal` to `GenericAbortSignal` to use the same naming style as `GenericFormData`;

* Added TS test for `GenericAbortSignal` interface;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 21:23:01 +02:00
Brian Helba eaaab30442 Fix TS definition for AxiosRequestTransformer (#4201)
The callback `AxiosRequestTransformer` can always expect its `headers`
parameter to be defined. This is ensured immediately before the callback
is made.
See: https://github.com/axios/axios/blob/1025d1231a7747503188459dd5a6d1effdcea928/lib/core/dispatchRequest.js#L32-L40

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 21:18:57 +02:00
reslear 1430393402 Update README.md (#4207)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 21:12:12 +02:00
Jay a0d742c299 Merge branch 'master' of github.com:axios/axios 2022-05-04 20:55:02 +02:00
Jay 6e0ab653db Merge branch 'oscard0m-add-cache-to-node-workflows' 2022-05-04 20:52:50 +02:00
Jay 21edbc2c92 Fix merge conflict 2022-05-04 20:52:33 +02:00
Luca Pizzini 1de70bd130 refactor: added listen callback function (#4096)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 20:42:36 +02:00
Cat Scarlet 5affc9d08e Updating trim() polyfill. According to mdn: https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md (#4072)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 20:25:23 +02:00
Jay e8e4749ebf Updated all browser logos to be correct 2022-05-04 19:27:42 +02:00
Kai b4d87ce6ca Updating HTTP links in README.md to use HTTPS (#4387)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 18:15:37 +02:00
Maxime Bargiel 9ca2779d7a Fixing http tests to avoid hanging when assertions fail (#4435)
* Fixing cases of Axios hanging on test failures

* Fix max redirect assertion

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-04 17:54:14 +02:00
Dave Cardwell 8213929595 Bump follow-redirects from 1.14.9 to 1.15.0 (#4673)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.9 to 1.15.0.
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.9...v1.15.0)
2022-05-04 09:53:12 +02:00
Kumar Shanu 6b1ae0b84a Edited readme with 3 updated browser icons. (#4414)
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>
2022-05-03 21:46:08 +02:00
JALAL eef2f97281 replace deprecated substr() with slice() (#4468)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 21:39:40 +02:00
Dmitriy Mozgovoy ad27f803d7 Changed func-names eslint rule to as-needed; (#4492)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 21:17:06 +02:00
Jingyi Lin ba85e0e385 style: fix word spelling ang lint style in comment (#4500)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 21:12:16 +02:00
Philipp Loose 3479ca7c76 Updating typing for AxiosPromise (#4505)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 21:07:09 +02:00
Alexander Shchukin 484443f251 fix url to defaults.js (#4532)
fix url to defaults.js

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 20:35:59 +02:00
Arthur Fiorette ff1e5cd6c2 Include request and config when creating a CanceledError. (#4659)
* changes

* also include request

* revert comment

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 20:33:38 +02:00
Dmitriy Mozgovoy c07998a621 Added generic TS types for the exposed toFormData helper; (#4668) 2022-05-03 20:29:50 +02:00
zhoulixiang e52af17ee8 opt: opt judgment code of cancel (#4587)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 19:04:58 +02:00
Ted Robertson e9efc69f68 Emphasize the URLSearchParam built-in interface (#4590)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 19:00:38 +02:00
Jay a9aea9b97d Added lock file with rollup added 2022-05-03 18:55:43 +02:00
Dmitriy Mozgovoy fe2563060d Replaced webpack with rollup; (#4596)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 18:53:02 +02:00
aong a41f129acf Update README.md (#4599)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 18:50:13 +02:00
Des Preston 7920d11144 Updating AxiosError to include stack trace (#4624)
Related to discussions here https://github.com/axios/axios/issues/2387

Attempt to capture the stack trace at the time the error is created in
order to maintain context about where the error originates from.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 18:46:10 +02:00
Michael Li 8213da4f16 fix(type): add AxiosError to AxiosStatic (#4654)
https://github.com/axios/axios/blob/master/lib/axios.js#L47

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 18:43:37 +02:00
Dan Mooney 8fb0f2689d Update README.md (#4649)
Fix grammar

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 18:40:15 +02:00
Bertrand Marron 205bd0f01d Make AxiosError.config optional in the type definition (#4665)
It is optional in the constructor, and not always defined.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-05-03 18:37:51 +02:00
Dmitriy Mozgovoy 12faca87e0 Removed wrong argument for NetworkError constructor; (#4656) 2022-05-03 18:30:17 +02:00
Jay bc733fec78 Releasing v0.27.2 2022-04-27 11:58:12 +02:00
Dmitriy Mozgovoy b9e9fb4fa0 Enhanced protocol parsing implementation to fix #4633; (#4639)
Added unit tests;

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-04-27 11:30:50 +02:00
Dmitriy Mozgovoy 76432c18be Fixed FormData posting in browser environment by reverting #3785; (#4640)
* Fixed posting FormData in browser environment by reverting #3785;

* Added ability to keep `Content-Type` header in non-standard browser environments;

* Added browser test of FormData posting using external HTTP service (https://httpbin.org/post);

Co-authored-by: Jay <jasonsaayman@gmail.com>
2022-04-27 11:26:52 +02:00
Jay 82fd15f3d4 Combined build process and cleaned it up a bit 2022-04-26 14:24:18 +02:00
Jay 1d82af1a50 Fixing issues with bundle sizes 2022-04-26 14:23:05 +02:00