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

19 Commits

Author SHA1 Message Date
Julian Hollmann 83ae3830e4 Correctly add response interceptors to interceptor chain (#4013) 2021-09-04 20:55:38 +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
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
Xianming Zhong fa3673710e fix axios.delete ignores config.data (#3282)
Co-authored-by: Jay <jasonsaayman@gmail.com>
2020-10-01 09:46:32 +02:00
Xianming Zhong 0d69a79c81 Refactor mergeConfig without utils.deepMerge (#2844)
* Adding failing test

* Fixing #2587 default custom config persisting

* Adding Concat keys and filter duplicates

* Fixed value from CPE

* update for review feedbacks

* no deepMerge

* only merge between plain objects

* fix rename

* always merge config by mergeConfig

* extract function mergeDeepProperties

* refactor mergeConfig with all keys, and add special logic for validateStatus

* add test for resetting headers

* add lots of tests and fix a bug

* should not inherit `data`

* use simple toString

* revert #1845

Co-authored-by: David Tanner <david.tanner@lifeomic.com>
Co-authored-by: Justin Beckwith <justin.beckwith@gmail.com>
2020-06-08 20:52:45 +02:00
bushuai e50a08b2c3 Fixing set config.method after mergeConfig for Axios.prototype.request (#2383)
Inside Axios.prototype.request function, It's forced to set
method to 'get' after `mergeConfig` if config.method exists, which makes the defaults.method not effective.
2019-09-06 14:23:55 -03:00
Anthony Gauthier 4f98acc578 Add getUri method (#1712)
* Added getUri method

* Removed usage of "url"

* added method to README
2018-08-07 11:52:30 -06:00
Martti Laine 72c66dfdec Refactor and introduce deepMerge 2018-03-23 20:21:02 +01:00
Martti Laine d78204712a Clean up PR 2018-03-09 13:58:08 +02:00
Martti Laine 5bfd2ea9f6 Fixing #385 - Keep defaults local to instance 2018-03-02 12:31:15 +02:00
Haven 2b8562694e Fixing baseURL not working in interceptors (#950)
* Fixing baseURL not working in interceptors

* add test for  modify base URL in request interceptor
2017-08-12 14:15:27 +02:00
杨春旭 e4e32120ce Convert the method parameter to lowercase 2017-05-31 22:53:11 +08:00
Nick Uraltsev 2fe95621b0 Merge pull request #461 from theikkila/master
Add OPTIONS-method as a shortcut
2017-03-26 21:06:24 -07:00
Nick Uraltsev 6d0e19343a Fixing bug with custom intances and global defaults 2016-11-26 18:17:21 -08:00
Teemu Heikkilä 2e0adc1cae Add OPTIONS-method as a shortcut 2016-09-29 18:54:17 +03:00
Matt Zabriskie 46eee269da Fixing custom instance defaults
closes #341
2016-06-23 15:19:10 -06:00
Matt Zabriskie e833a2f7e4 Invoke request transformers after request interceptors
closes #352
2016-06-23 14:55:22 -06:00
Matt Zabriskie f21784ccb8 Removing restriction on withCredentials being overridden
closes #343
2016-06-23 14:04:27 -06:00
Matt Zabriskie 0e2f4f1417 Moving Axios class into core/ 2016-06-01 14:42:14 -06:00