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

37 Commits

Author SHA1 Message Date
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
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
Jason Kwok f472e5da5f Adding a type guard for AxiosError (#2949)
Co-authored-by: Jason Kwok <JasonHK@users.noreply.github.com>
2020-11-03 10:01:07 +02:00
Remco Haszing 820fe6e41a Updating axios in types to be lower case (#2797)
Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
2020-10-27 20:36:32 +08:00
Taemin Shin 3a8b87d48a Fixing an issue that type 'null' and 'undefined' is not assignable to validateStatus when typescript strict option is enabled (#3200) 2020-10-20 08:04:44 +02:00
Remco Haszing b7e954eba3 Fixing node types (#3237)
The `ProgressEvent` type comes from the `DOM` lib. This is typically unwanted
when using axios in a NodeJS environment.

Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-10-01 09:42:09 +02:00
Taemin Shin b03f16159e Fixing an issue that type 'null' is not assignable to validateStatus (#2773)
Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-05-27 19:18:28 +02:00
Benny Neugebauer c120f44d3d Fixing 'progressEvent' type (#2851)
* Fix 'progressEvent' type

* Update axios.ts
2020-03-28 17:51:42 +08:00
Motonori Iwata 5189afff38 Allow PURGE method in typings (#2191)
Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
2020-03-07 14:45:25 +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
Luke Policinski bbfd5b1395 Adding options typings (#2341) 2019-11-03 21:17:27 -08:00
Marlon Barcarol b0afbedf1b Adding Typescript HTTP method definition for LINK and UNLINK. (#2444) 2019-11-03 19:29:51 -08:00
IVLIU 6284abfa06 custom timeout prompt copy (#2275)
* style: ui

* feat: custom timeout txtx

* feat: custom timeout txtx
2019-10-15 22:29:16 -03:00
Tiago Rodrigues 006b60425c Add toJSON property to AxiosError type (#2427)
I noticed the error object has a `toJSON` method but when I tried to use it in my typescript code it complained it didn't exist, even though I was using the `AxiosError` type.
2019-09-26 09:11:34 -03:00
Suman Lama 047501f708 Makes Axios error generic to use AxiosResponse (#1738) 2019-05-07 15:14:57 -04:00
Ken Powers 75c8b3f146 Allow uppercase methods in typings. (#1781) 2018-09-17 18:25:07 +02:00
Alexander Trauzzi 7db0494579 Add getUri signature to TypeScript definition. (#1736)
* Add `getUri` signature to TypeScript definition.

This is in support of #1624.

* Make configuration optional.
2018-08-21 08:24:53 -06:00
Ayush Gupta b681e919c4 Adding isAxiosError flag to errors thrown by axios (#1419) 2018-08-20 11:02:23 +02:00
Khaled Garbaya 7d9a29ee4c Fixing http adapter to allow HTTPS connections via HTTP (#959) 2018-07-04 23:51:11 -07:00
Sako Hartounian 84388b0389 cleaner definitions with union types. (#1551) 2018-07-04 23:48:07 -07:00
Stephan Schneider 73cab975f0 typings: allow custom return types
response interceptor might change the type from AxiosResponse to anything they like
2018-06-18 10:48:29 +02:00
Shane Fitzpatrick dd16944ecf Adding better 'responseType' and 'method' type definitions by using a string literal union type of possible values (#1148) 2018-04-08 00:19:46 -07:00
Yutaro Miyazaki 524f5bf10a fix: Fix type error when socketPath option in AxiosRequestConfig 2018-04-06 20:44:20 -07:00
Andrew Scott fbb29e07cc Fixing missing type parameters on delete/head 2018-03-07 22:13:02 -08:00
Punit Gupta 521a429f2d fix(index.d.ts): Remove redundant types 2017-12-21 15:24:34 +05:30
Punit Gupta 423923217e Fixing interface of axios instance 2017-11-20 21:53:47 +05:30
niris f0293696e7 Fixing typing issues #1154 #1147 2017-11-12 12:30:02 +08:00
Paul Sachs 1005e3bf14 Updating typings
The first argument in `axios.interceptors.response.use` is optional, in the case that you just want to intercept an error.

Ex:

```ts
axios.interceptors.response.use(undefined, error => {
...
});
```
2017-11-03 11:57:12 -04:00
Nick Uraltsev 8bea343f3d Merge pull request #1125 from keenondrums/master
Update AxiosTransformer type in index.d.ts
2017-10-24 07:51:08 -07:00
Nick Uraltsev 3f90738f48 Merge pull request #1131 from jmmk/axios-response-request
Add request field to AxiosResponse type definition
2017-10-24 07:47:16 -07:00
Michael McLellan 48ece5adbd Add request field to AxiosResponse type 2017-10-14 23:25:37 -04:00
Andrei Goncharov 1f333ca645 Update index.d.ts 2017-10-11 15:12:51 -06:00
Daniel Fischer b0dccc6f16 Updated TypeScript typings with generic type parameters for request methods & AxiosResponse 2017-08-29 20:53:49 +02:00
Michael Marvick 6508280bbf Updating Typescript typing for AxiosError to include request? param (#1015) 2017-08-12 13:12:20 +02:00
Nick Uraltsev 3704d57ed4 Removing Promise from axios typings in favor of built-in type declarations 2017-03-14 19:23:05 -07:00
Denis 63ee3573c2 Renaming axios.d.ts to index.d.ts 2016-11-09 22:21:56 -08:00