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

1043 Commits

Author SHA1 Message Date
Jay 6d1e30fd80 Prepared release notes 2021-10-12 10:34:20 +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
Remco Haszing 94a9344799 Test types (#4140)
* Distinguish request and response data types

* Fix Axios headers type

`axios.headers` is not of the same type as `request.headers`, so a new type
`AxiosDefaults` was introduced

* Replace grunt-ts with dtslint

This asserts that the type definitions are valid in the specified TypeScript
version and above. This is the same tool that is used by DefinitelyTyped.

* Remove grunt-ts

* Restore typescript dependency

* Fix missing semicolons

Co-authored-by: Claas Augner <github@caugner.de>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-12 09:53:10 +02:00
Dmitriy Mozgovoy fce210a67e Fixed TransitionalOptions typings (#4147)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-12 09:46:16 +02:00
Jay 547815d9fd Mending merge conflict 2021-10-12 09:43:02 +02:00
Evgeniy e462973a4b fix response headers types (#4136)
* fix response headers types

some keys like 'set-cookie' are arrays https://github.com/axios/axios/blob/master/lib/helpers/parseHeaders.js#L45

* split header types
2021-10-07 19:23:29 +02:00
Claas Augner 7c9a5c5c84 Fix missing semicolon in typings (#4115)
Fixes #4109.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-06 21:11:00 +02:00
Remco Haszing 6c002323a6 Change never type to unknown (#4142)
* Distinguish request and response data types

* Change never type to unknown

Using `never` was a workaround I introduced in 3002, because `unknown` wasn’t
supperted by all relevant versions of TypeScript at the time. It is now, and
it is much more correct.

Co-authored-by: Claas Augner <github@caugner.de>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-06 20:13:06 +02:00
Claas Augner 28a06e6d95 Distinguish request and response data types (#4116)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-06 20:10:01 +02:00
Jay ba9c193037 Release/v0.22.0 (#4143)
* 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-06 20:02:30 +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
Igor Randjelovic 7d6bddba2d Fix node version on CI (#4069)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-17 08:41:32 +02:00
Dobes Vandermeer 96956e30ba Improve timeout error when timeout is browser default (#3209)
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>
2021-09-16 21:16:43 +02:00
Paweł Szymański e52cd3ac64 Add globalObject: 'this' to webpack config (#3176)
This should solve the issue of undefined `this` when importing from an ES6 module.
I've put steps to reproduce in [this comment](https://github.com/axios/axios/issues/1861#issuecomment-669832435).

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-16 21:08:40 +02:00
Evan Finkelstein 2bc250786f Adding insecureHTTPParser type to AxiosRequestConfig 2021-09-15 13:47:14 -07:00
Matt R. Wilson f3ca6371ca Caseless header comparing in HTTP adapter. (#2880)
* 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>
2021-09-07 20:30:30 +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
Remco Haszing 90205f8ab7 Change headers type to string record (#3021)
This correctly reflects the type in a more type safe manner.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-05 14:14:12 +02:00
Remco Haszing 92b29d2775 Make the default type of response data never (#3002)
This requires TypeScript users to explicitly define the type of the data they
are consuming.

Before this, data was `any` by default. This means TypeScript consumers didn’t
get type safety if they forgot to specify the type.

Technically this is a breaking change for TypeScript users, as this will report
errors if they forgot to specifiy the response type. The simplest workaround
would be to explicitly set the response type to `any`, so it’s not breaking
much.

The `unknown` type is probably a slightly better fit, but this requires
TypeScript ^3.

`data` is still `any` in the very specific use case mentioned in
https://github.com/microsoft/TypeScript/issues/38969

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-05 14:11:25 +02:00
Carlos Chida 4eeb3b17e2 Improved type-safety for AxiosRequestConfig (#2995)
* Improved type-safety for AxiosRequestConfig

- AxiosRequestConfig is now a generic type whose template corresponds to data

Signed-off-by: Carlos Chida <carlos.chida@starchitecture.eu>

* Fixed tests

- TS tests now match the behaviour described in the PR

Signed-off-by: Carlos Chida <carlos.chida@starchitecture.eu>

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-05 14:06:05 +02:00
Greg Byrne cd7ff042b0 Adding HTTP status code to error.toJSON (#2956)
* 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>
2021-09-05 13:45:24 +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
Tim Düsterhus 4f25380b31 Exposing the Axios constructor in index.d.ts (#2872)
This patch allows TypeScript users to extend the `Axios` class without
the type checker complaining.

see 7548f2f79d

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-05 12:48:46 +02:00
howel52 c26762f898 Adding types entry in package.json (#2831)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-05 12:35:24 +02:00
Isaac Whitfield 69d3cc4f3e Allow create() to be used recursively (#2795)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-05 12:24:50 +02:00
Jay e367be54dc [Releasing] 0.21.3 2021-09-04 21:01:50 +02:00
Julian Hollmann 83ae3830e4 Correctly add response interceptors to interceptor chain (#4013) 2021-09-04 20:55:38 +02:00
Jay c0c8761091 [Updating] changelog to include links to issues and contributors 2021-09-04 11:57:32 +02:00
Jay 619bb465da [Releasing] v0.21.2 2021-09-04 11:28:54 +02:00
Ziding Zhang 82c9455591 Create SECURITY.md (#3981)
* Create SECURITY.md

A simple instruction for security researchers.

* Adding security report email address

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-02 10:14:12 +02:00
ready-research 5b457116e3 Security fix for ReDoS (#3980) 2021-08-30 14:33:43 +02:00
Matt Czapliński 5bc9ea24dd Update ECOSYSTEM.md (#3817)
Add axios-multi-api to the list

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-08-13 15:00:27 +02:00
Nash e72813a385 Fixing README.md (#3818)
* Fixing README.md

* Update README.md

Co-authored-by: Asher Hwang <dev@hsh.kr>

Co-authored-by: Asher Hwang <dev@hsh.kr>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-08-13 14:57:35 +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
Kohta Ito 4fbeecbcb2 Adding CI on Github Actions. (#3938) 2021-08-13 14:27:17 +02:00
Brian Anglin e9965bfafc Fixing the sauce labs tests (#3813) 2021-05-27 07:44:43 +02:00
Daniel Lopretto dbc634cf70 Remove charset in tests (#3807)
* removed charset setting when setting default header

* Remove charset from tests

Co-authored-by: mpark86 <dev.minuk.park@gmail.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
Co-authored-by: Pilot <timemachine@ctrl-c.club>
2021-05-21 07:51:31 +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
hippo 69949a6c16 Adding custom return type support to interceptor (#3783)
close #3448

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-05-14 16:08:36 +02:00
Jay 49509f6e95 Create FUNDING.yml (#3796)
Add open collective to repo
2021-05-13 14:48:43 +02:00
Philipe Gouveia Paixão 199c8aab64 Adding parseInt to config.timeout (#3781)
* Adding parseInt to config.timeout

* Fixing test message
2021-05-06 15:54:22 +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
Mark 0ece97c7a9 Fixing quadratic runtime when setting a maxContentLength (#3738)
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>
2021-05-04 19:48:20 +02:00
TagawaHirotaka a18a0eccb5 Updating lib/core/README.md about Dispatching requests (#3772)
* Updating lib/core/README.md :Dispatching requests

* Fixing expression
2021-04-30 09:08:50 +02:00
Jay 59fa6147eb [Updated] follow-redirects to the latest version (#3771) 2021-04-29 18:08:00 +02:00
Dmitriy Mozgovoy 7821ed2089 Feat/json improvements (#3763)
* 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);

* Removed unnecessary assertion;
2021-04-19 22:05:48 +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