axios 0.19.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +65 -4
- package/README.md +31 -6
- package/dist/axios.js +204 -139
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +2 -8
- package/dist/axios.min.map +1 -1
- package/index.d.ts +5 -0
- package/lib/adapters/http.js +12 -8
- package/lib/adapters/xhr.js +11 -5
- package/lib/core/Axios.js +9 -1
- package/lib/core/buildFullPath.js +20 -0
- package/lib/core/dispatchRequest.js +1 -8
- package/lib/core/mergeConfig.js +31 -9
- package/lib/defaults.js +4 -5
- package/lib/helpers/isURLSameOrigin.js +5 -0
- package/lib/helpers/isValidXss.js +7 -0
- package/lib/utils.js +21 -11
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
@@ -1,25 +1,87 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 0.19.1 (Jan 7, 2020)
|
4
|
+
|
5
|
+
Fixes and Functionality:
|
6
|
+
|
7
|
+
- Fixing invalid agent issue (#1904)[https://github.com/axios/axios/pull/1904]
|
8
|
+
- Fix ignore set withCredentials false (#2582)[https://github.com/axios/axios/pull/2582]
|
9
|
+
- Delete useless default to hash (#2458)[https://github.com/axios/axios/pull/2458]
|
10
|
+
- Fix HTTP/HTTPs agents passing to follow-redirect (#1904)[https://github.com/axios/axios/pull/1904]
|
11
|
+
- Fix ignore set withCredentials false (#2582)[https://github.com/axios/axios/pull/2582]
|
12
|
+
- Fix CI build failure (#2570)[https://github.com/axios/axios/pull/2570]
|
13
|
+
- Remove dependency on is-buffer from package.json (#1816)[https://github.com/axios/axios/pull/1816]
|
14
|
+
- Adding options typings (#2341)[https://github.com/axios/axios/pull/2341]
|
15
|
+
- Adding Typescript HTTP method definition for LINK and UNLINK. (#2444)[https://github.com/axios/axios/pull/2444]
|
16
|
+
- Update dist with newest changes, fixes Custom Attributes issue
|
17
|
+
- Change syntax to see if build passes (#2488)[https://github.com/axios/axios/pull/2488]
|
18
|
+
- Update Webpack + deps, remove now unnecessary polyfills (#2410)[https://github.com/axios/axios/pull/2410]
|
19
|
+
- Fix to prevent XSS, throw an error when the URL contains a JS script (#2464)[https://github.com/axios/axios/pull/2464]
|
20
|
+
- Add custom timeout error copy in config (#2275)[https://github.com/axios/axios/pull/2275]
|
21
|
+
- Add error toJSON example (#2466)[https://github.com/axios/axios/pull/2466]
|
22
|
+
- Fixing Vulnerability A Fortify Scan finds a critical Cross-Site Scrip… (#2451)[https://github.com/axios/axios/pull/2451]
|
23
|
+
- Fixing subdomain handling on no_proxy (#2442)[https://github.com/axios/axios/pull/2442]
|
24
|
+
- Make redirection from HTTP to HTTPS work (#2426)[https://github.com/axios/axios/pull/2426] and (#2547)[https://github.com/axios/axios/pull/2547]
|
25
|
+
- Add toJSON property to AxiosError type (#2427)[https://github.com/axios/axios/pull/2427]
|
26
|
+
- Fixing socket hang up error on node side for slow response. (#1752)[https://github.com/axios/axios/pull/1752]
|
27
|
+
- Alternative syntax to send data into the body (#2317)[https://github.com/axios/axios/pull/2317]
|
28
|
+
- Fixing custom config options (#2207)[https://github.com/axios/axios/pull/2207]
|
29
|
+
- Fixing set `config.method` after mergeConfig for Axios.prototype.request (#2383)[https://github.com/axios/axios/pull/2383]
|
30
|
+
- Axios create url bug (#2290)[https://github.com/axios/axios/pull/2290]
|
31
|
+
- Do not modify config.url when using a relative baseURL (resolves [#1628](https://github.com/axios/axios/issues/1098)) (#2391)[https://github.com/axios/axios/pull/2391]
|
32
|
+
- Add typescript HTTP method definition for LINK and UNLINK ([#2444](https://github.com/axios/axios/pull/2444))
|
33
|
+
|
34
|
+
Internal:
|
35
|
+
|
36
|
+
- Revert "Update Webpack + deps, remove now unnecessary polyfills" (#2479)[https://github.com/axios/axios/pull/2479]
|
37
|
+
- Order of if/else blocks is causing unit tests mocking XHR. (#2201)[https://github.com/axios/axios/pull/2201]
|
38
|
+
- Add license badge (#2446)[https://github.com/axios/axios/pull/2446]
|
39
|
+
- Fix travis CI build [#2386](https://github.com/axios/axios/pull/2386)
|
40
|
+
- Fix cancellation error on build master. #2290 #2207 (#2407)[https://github.com/axios/axios/pull/2407]
|
41
|
+
|
42
|
+
Documentation:
|
43
|
+
|
44
|
+
- Fixing typo in CHANGELOG.md: s/Functionallity/Functionality (#2639)[https://github.com/axios/axios/pull/2639]
|
45
|
+
- Fix badge, use master branch (#2538)[https://github.com/axios/axios/pull/2538]
|
46
|
+
- Fix typo in changelog [#2193](https://github.com/axios/axios/pull/2193)
|
47
|
+
- Document fix (#2514)[https://github.com/axios/axios/pull/2514]
|
48
|
+
- Update docs with no_proxy change, issue #2484 (#2513)[https://github.com/axios/axios/pull/2513]
|
49
|
+
- Fixing missing words in docs template (#2259)[https://github.com/axios/axios/pull/2259]
|
50
|
+
- 🐛Fix request finally documentation in README (#2189)[https://github.com/axios/axios/pull/2189]
|
51
|
+
- updating spelling and adding link to docs (#2212)[https://github.com/axios/axios/pull/2212]
|
52
|
+
- docs: minor tweak (#2404)[https://github.com/axios/axios/pull/2404]
|
53
|
+
- Update response interceptor docs (#2399)[https://github.com/axios/axios/pull/2399]
|
54
|
+
- Update README.md (#2504)[https://github.com/axios/axios/pull/2504]
|
55
|
+
- Fix word 'sintaxe' to 'syntax' in README.md (#2432)[https://github.com/axios/axios/pull/2432]
|
56
|
+
- upadating README: notes on CommonJS autocomplete (#2256)[https://github.com/axios/axios/pull/2256]
|
57
|
+
- Fix grammar in README.md (#2271)[https://github.com/axios/axios/pull/2271]
|
58
|
+
- Doc fixes, minor examples cleanup (#2198)[https://github.com/axios/axios/pull/2198]
|
59
|
+
|
3
60
|
### 0.19.0 (May 30, 2019)
|
4
61
|
|
5
62
|
Fixes and Functionality:
|
6
63
|
|
64
|
+
- Added support for no_proxy env variable ([#1693](https://github.com/axios/axios/pull/1693/files)) - Chance Dickson
|
7
65
|
- Unzip response body only for statuses != 204 ([#1129](https://github.com/axios/axios/pull/1129)) - drawski
|
8
|
-
- Destroy stream on exceeding maxContentLength (fixes [#1098](https://github.com/axios/axios/
|
66
|
+
- Destroy stream on exceeding maxContentLength (fixes [#1098](https://github.com/axios/axios/issues/1098)) ([#1485](https://github.com/axios/axios/pull/1485)) - Gadzhi Gadzhiev
|
9
67
|
- Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama
|
10
68
|
- Fixing Mocha tests by locking follow-redirects version to 1.5.10 ([#1993](https://github.com/axios/axios/pull/1993)) - grumblerchester
|
11
69
|
- Allow uppercase methods in typings. ([#1781](https://github.com/axios/axios/pull/1781)) - Ken Powers
|
12
|
-
- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel
|
13
|
-
- Consistent coding style ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez
|
14
70
|
- Fixing building url with hash mark ([#1771](https://github.com/axios/axios/pull/1771)) - Anatoly Ryabov
|
15
71
|
- This commit fix building url with hash map (fragment identifier) when parameters are present: they must not be added after `#`, because client cut everything after `#`
|
16
72
|
- Preserve HTTP method when following redirect ([#1758](https://github.com/axios/axios/pull/1758)) - Rikki Gibson
|
17
73
|
- Add `getUri` signature to TypeScript definition. ([#1736](https://github.com/axios/axios/pull/1736)) - Alexander Trauzzi
|
18
74
|
- Adding isAxiosError flag to errors thrown by axios ([#1419](https://github.com/axios/axios/pull/1419)) - Ayush Gupta
|
75
|
+
|
76
|
+
Internal:
|
77
|
+
|
78
|
+
- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel
|
19
79
|
- Fix failing SauceLabs tests by updating configuration - Emily Morehouse
|
80
|
+
- Add issue templates - Emily Morehouse
|
20
81
|
|
21
82
|
Documentation:
|
22
83
|
|
84
|
+
- Consistent coding style in README ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez
|
23
85
|
- Add information about auth parameter to README ([#2166](https://github.com/axios/axios/pull/2166)) - xlaguna
|
24
86
|
- Add DELETE to list of methods that allow data as a config option ([#2169](https://github.com/axios/axios/pull/2169)) - Daniela Borges Matos de Carvalho
|
25
87
|
- Update ECOSYSTEM.md - Add Axios Endpoints ([#2176](https://github.com/axios/axios/pull/2176)) - Renan
|
@@ -30,7 +92,6 @@ Documentation:
|
|
30
92
|
- Clarify what values responseType can have in Node ([#2121](https://github.com/axios/axios/pull/2121)) - Tyler Breisacher
|
31
93
|
- docs(ECOSYSTEM): add axios-api-versioning ([#2020](https://github.com/axios/axios/pull/2020)) - Weffe
|
32
94
|
- It seems that `responseType: 'blob'` doesn't actually work in Node (when I tried using it, response.data was a string, not a Blob, since Node doesn't have Blobs), so this clarifies that this option should only be used in the browser
|
33
|
-
- Add issue templates - Emily Morehouse
|
34
95
|
- Update README.md. - Add Querystring library note ([#1896](https://github.com/axios/axios/pull/1896)) - Dmitriy Eroshenko
|
35
96
|
- Add react-hooks-axios to Libraries section of ECOSYSTEM.md ([#1925](https://github.com/axios/axios/pull/1925)) - Cody Chan
|
36
97
|
- Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer
|
package/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# axios
|
2
2
|
|
3
3
|
[](https://www.npmjs.org/package/axios)
|
4
|
-
[](https://travis-ci.org/axios/axios)
|
4
|
+
[](https://travis-ci.org/axios/axios)
|
5
5
|
[](https://coveralls.io/r/mzabriskie/axios)
|
6
6
|
[](https://packagephobia.now.sh/result?p=axios)
|
7
7
|
[](http://npm-stat.com/charts.html?package=axios)
|
@@ -57,6 +57,15 @@ Using cdn:
|
|
57
57
|
|
58
58
|
## Example
|
59
59
|
|
60
|
+
### note: CommonJS usage
|
61
|
+
In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()` use the following approach:
|
62
|
+
|
63
|
+
```js
|
64
|
+
const axios = require('axios').default;
|
65
|
+
|
66
|
+
// axios.<method> will now provide autocomplete and parameter typings
|
67
|
+
```
|
68
|
+
|
60
69
|
Performing a `GET` request
|
61
70
|
|
62
71
|
```js
|
@@ -88,7 +97,7 @@ axios.get('/user', {
|
|
88
97
|
.catch(function (error) {
|
89
98
|
console.log(error);
|
90
99
|
})
|
91
|
-
.
|
100
|
+
.finally(function () {
|
92
101
|
// always executed
|
93
102
|
});
|
94
103
|
|
@@ -286,6 +295,11 @@ These are the available config options for making requests. Only the `url` is re
|
|
286
295
|
data: {
|
287
296
|
firstName: 'Fred'
|
288
297
|
},
|
298
|
+
|
299
|
+
// syntax alternative to send data into the body
|
300
|
+
// method post
|
301
|
+
// only the value is sent, not the key
|
302
|
+
data: 'Country=Brasil&City=Belo Horizonte',
|
289
303
|
|
290
304
|
// `timeout` specifies the number of milliseconds before the request times out.
|
291
305
|
// If the request takes longer than `timeout`, the request will be aborted.
|
@@ -413,7 +427,7 @@ The response for a request contains the following information.
|
|
413
427
|
|
414
428
|
// `request` is the request that generated this response
|
415
429
|
// It is the last ClientRequest instance in node.js (in redirects)
|
416
|
-
// and an XMLHttpRequest instance the browser
|
430
|
+
// and an XMLHttpRequest instance in the browser
|
417
431
|
request: {}
|
418
432
|
}
|
419
433
|
```
|
@@ -492,15 +506,17 @@ axios.interceptors.request.use(function (config) {
|
|
492
506
|
|
493
507
|
// Add a response interceptor
|
494
508
|
axios.interceptors.response.use(function (response) {
|
509
|
+
// Any status code that lie within the range of 2xx cause this function to trigger
|
495
510
|
// Do something with response data
|
496
511
|
return response;
|
497
512
|
}, function (error) {
|
513
|
+
// Any status codes that falls outside the range of 2xx cause this function to trigger
|
498
514
|
// Do something with response error
|
499
515
|
return Promise.reject(error);
|
500
516
|
});
|
501
517
|
```
|
502
518
|
|
503
|
-
If you
|
519
|
+
If you need to remove an interceptor later you can.
|
504
520
|
|
505
521
|
```js
|
506
522
|
const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
|
@@ -538,7 +554,7 @@ axios.get('/user/12345')
|
|
538
554
|
});
|
539
555
|
```
|
540
556
|
|
541
|
-
|
557
|
+
Using the `validateStatus` config option, you can define HTTP code(s) that should throw an error.
|
542
558
|
|
543
559
|
```js
|
544
560
|
axios.get('/user/12345', {
|
@@ -548,6 +564,15 @@ axios.get('/user/12345', {
|
|
548
564
|
})
|
549
565
|
```
|
550
566
|
|
567
|
+
Using `toJSON` you get an object with more information about the HTTP error.
|
568
|
+
|
569
|
+
```js
|
570
|
+
axios.get('/user/12345')
|
571
|
+
.catch(function (error) {
|
572
|
+
console.log(error.toJSON());
|
573
|
+
});
|
574
|
+
```
|
575
|
+
|
551
576
|
## Cancellation
|
552
577
|
|
553
578
|
You can cancel a request using a *cancel token*.
|
@@ -681,4 +706,4 @@ axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/
|
|
681
706
|
|
682
707
|
## License
|
683
708
|
|
684
|
-
MIT
|
709
|
+
[MIT](LICENSE)
|