axios 0.16.0 → 0.17.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 +128 -103
- package/README.md +45 -17
- package/UPGRADE_GUIDE.md +3 -3
- package/dist/axios.js +166 -114
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +8 -2
- package/dist/axios.min.map +1 -1
- package/index.d.ts +13 -11
- package/lib/adapters/http.js +22 -20
- package/lib/adapters/xhr.js +4 -3
- package/lib/core/Axios.js +1 -7
- package/lib/core/createError.js +5 -4
- package/lib/core/dispatchRequest.js +7 -0
- package/lib/core/enhanceError.js +4 -2
- package/lib/core/settle.js +1 -0
- package/lib/defaults.js +1 -0
- package/lib/helpers/parseHeaders.js +17 -1
- package/lib/utils.js +3 -1
- package/package.json +15 -7
package/CHANGELOG.md
CHANGED
@@ -1,199 +1,224 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 0.17.1 (Nov 11, 2017)
|
4
|
+
|
5
|
+
- Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160))
|
6
|
+
- Allowing overriding transport ([#1080](https://github.com/axios/axios/pull/1080))
|
7
|
+
- Updating TypeScript typings ([#1165](https://github.com/axios/axios/pull/1165), [#1125](https://github.com/axios/axios/pull/1125), [#1131](https://github.com/axios/axios/pull/1131))
|
8
|
+
|
9
|
+
### 0.17.0 (Oct 21, 2017)
|
10
|
+
|
11
|
+
- **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950))
|
12
|
+
- **BREAKING** Improving handing of duplicate headers ([#874](https://github.com/axios/axios/pull/874))
|
13
|
+
- Adding support for disabling proxies ([#691](https://github.com/axios/axios/pull/691))
|
14
|
+
- Updating TypeScript typings with generic type parameters ([#1061](https://github.com/axios/axios/pull/1061))
|
15
|
+
|
16
|
+
### 0.16.2 (Jun 3, 2017)
|
17
|
+
|
18
|
+
- Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887))
|
19
|
+
- Including underlying request in errors ([#830](https://github.com/axios/axios/pull/830))
|
20
|
+
- Convert `method` to lowercase ([#930](https://github.com/axios/axios/pull/930))
|
21
|
+
|
22
|
+
### 0.16.1 (Apr 8, 2017)
|
23
|
+
|
24
|
+
- Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828))
|
25
|
+
- Updating `follow-redirects` dependency ([#829](https://github.com/axios/axios/pull/829))
|
26
|
+
- Adding support for passing `Buffer` in node ([#773](https://github.com/axios/axios/pull/773))
|
27
|
+
|
3
28
|
### 0.16.0 (Mar 31, 2017)
|
4
29
|
|
5
|
-
- **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/
|
6
|
-
- Adding `options` shortcut method ([#461](https://github.com/
|
7
|
-
- Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/
|
8
|
-
- Improving React Native detection ([#731](https://github.com/
|
9
|
-
- Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/
|
10
|
-
- Removing `PROTECTION_PREFIX` support ([#561](https://github.com/
|
30
|
+
- **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480))
|
31
|
+
- Adding `options` shortcut method ([#461](https://github.com/axios/axios/pull/461))
|
32
|
+
- Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/axios/axios/pull/654))
|
33
|
+
- Improving React Native detection ([#731](https://github.com/axios/axios/pull/731))
|
34
|
+
- Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/axios/axios/pull/581))
|
35
|
+
- Removing `PROTECTION_PREFIX` support ([#561](https://github.com/axios/axios/pull/561))
|
11
36
|
|
12
37
|
### 0.15.3 (Nov 27, 2016)
|
13
38
|
|
14
|
-
- Fixing issue with custom instances and global defaults ([#443](https://github.com/
|
15
|
-
- Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/
|
16
|
-
- Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/
|
17
|
-
- Fixing issue with `btoa` and IE ([#507](https://github.com/
|
18
|
-
- Adding support for proxy authentication ([#483](https://github.com/
|
19
|
-
- Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/
|
20
|
-
- Fixing proxy issues ([#491](https://github.com/
|
39
|
+
- Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443))
|
40
|
+
- Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/axios/axios/issues/519))
|
41
|
+
- Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/axios/axios/issues/509))
|
42
|
+
- Fixing issue with `btoa` and IE ([#507](https://github.com/axios/axios/issues/507))
|
43
|
+
- Adding support for proxy authentication ([#483](https://github.com/axios/axios/pull/483))
|
44
|
+
- Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/axios/axios/pull/493))
|
45
|
+
- Fixing proxy issues ([#491](https://github.com/axios/axios/pull/491))
|
21
46
|
|
22
47
|
### 0.15.2 (Oct 17, 2016)
|
23
48
|
|
24
|
-
- Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/
|
49
|
+
- Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/axios/axios/issues/482))
|
25
50
|
|
26
51
|
### 0.15.1 (Oct 14, 2016)
|
27
52
|
|
28
|
-
- Fixing issue with UMD ([#485](https://github.com/
|
53
|
+
- Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485))
|
29
54
|
|
30
55
|
### 0.15.0 (Oct 10, 2016)
|
31
56
|
|
32
|
-
- Adding cancellation support ([#452](https://github.com/
|
33
|
-
- Moving default adapter to global defaults ([#437](https://github.com/
|
34
|
-
- Fixing issue with `file` URI scheme ([#440](https://github.com/
|
35
|
-
- Fixing issue with `params` objects that have no prototype ([#445](https://github.com/
|
57
|
+
- Adding cancellation support ([#452](https://github.com/axios/axios/pull/452))
|
58
|
+
- Moving default adapter to global defaults ([#437](https://github.com/axios/axios/pull/437))
|
59
|
+
- Fixing issue with `file` URI scheme ([#440](https://github.com/axios/axios/pull/440))
|
60
|
+
- Fixing issue with `params` objects that have no prototype ([#445](https://github.com/axios/axios/pull/445))
|
36
61
|
|
37
62
|
### 0.14.0 (Aug 27, 2016)
|
38
63
|
|
39
|
-
- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/
|
40
|
-
- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/
|
41
|
-
- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/
|
42
|
-
- Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/
|
43
|
-
- Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/
|
44
|
-
- Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/
|
64
|
+
- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419))
|
65
|
+
- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/axios/axios/pull/387))
|
66
|
+
- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/axios/axios/pull/423))
|
67
|
+
- Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/axios/axios/pull/366))
|
68
|
+
- Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/axios/axios/pull/397))
|
69
|
+
- Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/axios/axios/pull/406))
|
45
70
|
|
46
71
|
### 0.13.1 (Jul 16, 2016)
|
47
72
|
|
48
|
-
- Fixing issue with response data not being transformed on error ([#378](https://github.com/
|
73
|
+
- Fixing issue with response data not being transformed on error ([#378](https://github.com/axios/axios/issues/378))
|
49
74
|
|
50
75
|
### 0.13.0 (Jul 13, 2016)
|
51
76
|
|
52
|
-
- **BREAKING** Improved error handling ([#345](https://github.com/
|
53
|
-
- **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/
|
54
|
-
- **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/
|
55
|
-
- Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/
|
56
|
-
- Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/
|
57
|
-
- Fixing custom instance defaults ([#341](https://github.com/
|
58
|
-
- Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/
|
77
|
+
- **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345))
|
78
|
+
- **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e))
|
79
|
+
- **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a))
|
80
|
+
- Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/axios/axios/issues/343))
|
81
|
+
- Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/axios/axios/issues/352))
|
82
|
+
- Fixing custom instance defaults ([#341](https://github.com/axios/axios/issues/341))
|
83
|
+
- Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/axios/axios/issues/217))
|
59
84
|
|
60
85
|
### 0.12.0 (May 31, 2016)
|
61
86
|
|
62
|
-
- Adding support for `URLSearchParams` ([#317](https://github.com/
|
63
|
-
- Adding `maxRedirects` option ([#307](https://github.com/
|
87
|
+
- Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317))
|
88
|
+
- Adding `maxRedirects` option ([#307](https://github.com/axios/axios/pull/307))
|
64
89
|
|
65
90
|
### 0.11.1 (May 17, 2016)
|
66
91
|
|
67
|
-
- Fixing IE CORS support ([#313](https://github.com/
|
68
|
-
- Fixing detection of `FormData` ([#325](https://github.com/
|
69
|
-
- Adding `Axios` class to exports ([#321](https://github.com/
|
92
|
+
- Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313))
|
93
|
+
- Fixing detection of `FormData` ([#325](https://github.com/axios/axios/pull/325))
|
94
|
+
- Adding `Axios` class to exports ([#321](https://github.com/axios/axios/pull/321))
|
70
95
|
|
71
96
|
### 0.11.0 (Apr 26, 2016)
|
72
97
|
|
73
|
-
- Adding support for Stream with HTTP adapter ([#296](https://github.com/
|
74
|
-
- Adding support for custom HTTP status code error ranges ([#308](https://github.com/
|
75
|
-
- Fixing issue with ArrayBuffer ([#299](https://github.com/
|
98
|
+
- Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296))
|
99
|
+
- Adding support for custom HTTP status code error ranges ([#308](https://github.com/axios/axios/pull/308))
|
100
|
+
- Fixing issue with ArrayBuffer ([#299](https://github.com/axios/axios/pull/299))
|
76
101
|
|
77
102
|
### 0.10.0 (Apr 20, 2016)
|
78
103
|
|
79
|
-
- Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/
|
80
|
-
- Fixing basic auth for HTTP adapter ([#252](https://github.com/
|
81
|
-
- Fixing request timeout for XHR adapter ([#227](https://github.com/
|
82
|
-
- Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/
|
83
|
-
- Fixing IE9 cross domain requests ([#251](https://github.com/
|
84
|
-
- Adding `maxContentLength` option ([#275](https://github.com/
|
85
|
-
- Fixing XHR support for WebWorker environment ([#279](https://github.com/
|
86
|
-
- Adding request instance to response ([#200](https://github.com/
|
104
|
+
- Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250))
|
105
|
+
- Fixing basic auth for HTTP adapter ([#252](https://github.com/axios/axios/pull/252))
|
106
|
+
- Fixing request timeout for XHR adapter ([#227](https://github.com/axios/axios/pull/227))
|
107
|
+
- Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/axios/axios/pull/249))
|
108
|
+
- Fixing IE9 cross domain requests ([#251](https://github.com/axios/axios/pull/251))
|
109
|
+
- Adding `maxContentLength` option ([#275](https://github.com/axios/axios/pull/275))
|
110
|
+
- Fixing XHR support for WebWorker environment ([#279](https://github.com/axios/axios/pull/279))
|
111
|
+
- Adding request instance to response ([#200](https://github.com/axios/axios/pull/200))
|
87
112
|
|
88
113
|
### 0.9.1 (Jan 24, 2016)
|
89
114
|
|
90
|
-
- Improving handling of request timeout in node ([#124](https://github.com/
|
91
|
-
- Fixing network errors not rejecting ([#205](https://github.com/
|
92
|
-
- Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/
|
93
|
-
- Fixing host/port when following redirects ([#198](https://github.com/
|
115
|
+
- Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124))
|
116
|
+
- Fixing network errors not rejecting ([#205](https://github.com/axios/axios/pull/205))
|
117
|
+
- Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/axios/axios/issues/201))
|
118
|
+
- Fixing host/port when following redirects ([#198](https://github.com/axios/axios/pull/198))
|
94
119
|
|
95
120
|
### 0.9.0 (Jan 18, 2016)
|
96
121
|
|
97
122
|
- Adding support for custom adapters
|
98
|
-
- Fixing Content-Type header being removed when data is false ([#195](https://github.com/
|
99
|
-
- Improving XDomainRequest implementation ([#185](https://github.com/
|
100
|
-
- Improving config merging and order of precedence ([#183](https://github.com/
|
101
|
-
- Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/
|
123
|
+
- Fixing Content-Type header being removed when data is false ([#195](https://github.com/axios/axios/pull/195))
|
124
|
+
- Improving XDomainRequest implementation ([#185](https://github.com/axios/axios/pull/185))
|
125
|
+
- Improving config merging and order of precedence ([#183](https://github.com/axios/axios/pull/183))
|
126
|
+
- Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/axios/axios/pull/182))
|
102
127
|
|
103
128
|
### 0.8.1 (Dec 14, 2015)
|
104
129
|
|
105
|
-
- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/
|
106
|
-
- Fixing error with format of basic auth header ([#178](https://github.com/
|
107
|
-
- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/
|
130
|
+
- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168))
|
131
|
+
- Fixing error with format of basic auth header ([#178](https://github.com/axios/axios/pull/173))
|
132
|
+
- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/axios/axios/pull/174))
|
108
133
|
|
109
134
|
### 0.8.0 (Dec 11, 2015)
|
110
135
|
|
111
|
-
- Adding support for creating instances of axios ([#123](https://github.com/
|
112
|
-
- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/
|
113
|
-
- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/
|
114
|
-
- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/
|
115
|
-
- Adding support for following redirects in node ([#146](https://github.com/
|
116
|
-
- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/
|
117
|
-
- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/
|
118
|
-
- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/
|
119
|
-
- Adding support for baseURL option ([#160](https://github.com/
|
136
|
+
- Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123))
|
137
|
+
- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/axios/axios/pull/128))
|
138
|
+
- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/axios/axios/pull/121))
|
139
|
+
- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/axios/axios/pull/127))
|
140
|
+
- Adding support for following redirects in node ([#146](https://github.com/axios/axios/pull/146))
|
141
|
+
- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/axios/axios/pull/149))
|
142
|
+
- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/axios/axios/pull/140))
|
143
|
+
- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/axios/axios/pull/167))
|
144
|
+
- Adding support for baseURL option ([#160](https://github.com/axios/axios/pull/160))
|
120
145
|
|
121
146
|
### 0.7.0 (Sep 29, 2015)
|
122
147
|
|
123
|
-
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/
|
124
|
-
- Adding support for passing agent in node ([#102](https://github.com/
|
125
|
-
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/
|
126
|
-
- Fixing typescript definition ([#105](https://github.com/
|
127
|
-
- Fixing default timeout config for node ([#112](https://github.com/
|
128
|
-
- Adding support for use in web workers, and react-native ([#70](https://github.com/
|
129
|
-
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/
|
148
|
+
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87))
|
149
|
+
- Adding support for passing agent in node ([#102](https://github.com/axios/axios/pull/102))
|
150
|
+
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/axios/axios/pull/106))
|
151
|
+
- Fixing typescript definition ([#105](https://github.com/axios/axios/pull/105))
|
152
|
+
- Fixing default timeout config for node ([#112](https://github.com/axios/axios/pull/112))
|
153
|
+
- Adding support for use in web workers, and react-native ([#70](https://github.com/axios/axios/issue/70)), ([#98](https://github.com/axios/axios/pull/98))
|
154
|
+
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/axios/axios/issues/116))
|
130
155
|
|
131
156
|
### 0.6.0 (Sep 21, 2015)
|
132
157
|
|
133
158
|
- Removing deprecated success/error aliases
|
134
|
-
- Fixing issue with array params not being properly encoded ([#49](https://github.com/
|
135
|
-
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/
|
136
|
-
- Adding support for timeout config ([#56](https://github.com/
|
159
|
+
- Fixing issue with array params not being properly encoded ([#49](https://github.com/axios/axios/pull/49))
|
160
|
+
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/axios/axios/issues/69))
|
161
|
+
- Adding support for timeout config ([#56](https://github.com/axios/axios/issues/56))
|
137
162
|
- Removing es6-promise dependency
|
138
|
-
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/
|
139
|
-
- Fixing issue with IE8 ([#85](https://github.com/
|
163
|
+
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/axios/axios/pull/91))
|
164
|
+
- Fixing issue with IE8 ([#85](https://github.com/axios/axios/pull/85))
|
140
165
|
- Converting build to UMD
|
141
166
|
|
142
167
|
### 0.5.4 (Apr 08, 2015)
|
143
168
|
|
144
|
-
- Fixing issue with FormData not being sent ([#53](https://github.com/
|
169
|
+
- Fixing issue with FormData not being sent ([#53](https://github.com/axios/axios/issues/53))
|
145
170
|
|
146
171
|
### 0.5.3 (Apr 07, 2015)
|
147
172
|
|
148
|
-
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/
|
173
|
+
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55))
|
149
174
|
|
150
175
|
### 0.5.2 (Mar 13, 2015)
|
151
176
|
|
152
|
-
- Adding support for `statusText` in response ([#46](https://github.com/
|
177
|
+
- Adding support for `statusText` in response ([#46](https://github.com/axios/axios/issues/46))
|
153
178
|
|
154
179
|
### 0.5.1 (Mar 10, 2015)
|
155
180
|
|
156
|
-
- Fixing issue using strict mode ([#45](https://github.com/
|
157
|
-
- Fixing issue with standalone build ([#47](https://github.com/
|
181
|
+
- Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45))
|
182
|
+
- Fixing issue with standalone build ([#47](https://github.com/axios/axios/issues/47))
|
158
183
|
|
159
184
|
### 0.5.0 (Jan 23, 2015)
|
160
185
|
|
161
|
-
- Adding support for intercepetors ([#14](https://github.com/
|
186
|
+
- Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14))
|
162
187
|
- Updating es6-promise dependency
|
163
188
|
|
164
189
|
### 0.4.2 (Dec 10, 2014)
|
165
190
|
|
166
|
-
- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/
|
167
|
-
- Adding support for TypeScript ([#25](https://github.com/
|
168
|
-
- Fixing issue with standalone build ([#29](https://github.com/
|
169
|
-
- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/
|
191
|
+
- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22))
|
192
|
+
- Adding support for TypeScript ([#25](https://github.com/axios/axios/issues/25))
|
193
|
+
- Fixing issue with standalone build ([#29](https://github.com/axios/axios/issues/29))
|
194
|
+
- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/axios/axios/issues/30))
|
170
195
|
|
171
196
|
### 0.4.1 (Oct 15, 2014)
|
172
197
|
|
173
|
-
- Adding error handling to request for node.js ([#18](https://github.com/
|
198
|
+
- Adding error handling to request for node.js ([#18](https://github.com/axios/axios/issues/18))
|
174
199
|
|
175
200
|
### 0.4.0 (Oct 03, 2014)
|
176
201
|
|
177
|
-
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/
|
178
|
-
- Adding support for utf-8 for node.js ([#13](https://github.com/
|
179
|
-
- Adding support for SSL for node.js ([#12](https://github.com/
|
180
|
-
- Fixing incorrect `Content-Type` header ([#9](https://github.com/
|
181
|
-
- Adding standalone build without bundled es6-promise ([#11](https://github.com/
|
202
|
+
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10))
|
203
|
+
- Adding support for utf-8 for node.js ([#13](https://github.com/axios/axios/issues/13))
|
204
|
+
- Adding support for SSL for node.js ([#12](https://github.com/axios/axios/issues/12))
|
205
|
+
- Fixing incorrect `Content-Type` header ([#9](https://github.com/axios/axios/issues/9))
|
206
|
+
- Adding standalone build without bundled es6-promise ([#11](https://github.com/axios/axios/issues/11))
|
182
207
|
- Deprecating `success`/`error` in favor of `then`/`catch`
|
183
208
|
|
184
209
|
### 0.3.1 (Sep 16, 2014)
|
185
210
|
|
186
|
-
- Fixing missing post body when using node.js ([#3](https://github.com/
|
211
|
+
- Fixing missing post body when using node.js ([#3](https://github.com/axios/axios/issues/3))
|
187
212
|
|
188
213
|
### 0.3.0 (Sep 16, 2014)
|
189
214
|
|
190
|
-
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/
|
191
|
-
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/
|
192
|
-
- Fixing issue with `all` not working ([#7](https://github.com/
|
215
|
+
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8))
|
216
|
+
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/axios/axios/issues/6))
|
217
|
+
- Fixing issue with `all` not working ([#7](https://github.com/axios/axios/issues/7))
|
193
218
|
|
194
219
|
### 0.2.2 (Sep 14, 2014)
|
195
220
|
|
196
|
-
- Fixing bundling with browserify ([#4](https://github.com/
|
221
|
+
- Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4))
|
197
222
|
|
198
223
|
### 0.2.1 (Sep 12, 2014)
|
199
224
|
|
@@ -202,7 +227,7 @@
|
|
202
227
|
### 0.2.0 (Sep 12, 2014)
|
203
228
|
|
204
229
|
- Adding support for `all` and `spread`
|
205
|
-
- Adding support for node.js ([#1](https://github.com/
|
230
|
+
- Adding support for node.js ([#1](https://github.com/axios/axios/issues/1))
|
206
231
|
|
207
232
|
### 0.1.0 (Aug 29, 2014)
|
208
233
|
|
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)
|
5
5
|
[](https://coveralls.io/r/mzabriskie/axios)
|
6
6
|
[](http://npm-stat.com/charts.html?package=axios)
|
7
7
|
[](https://gitter.im/mzabriskie/axios)
|
@@ -125,6 +125,18 @@ axios({
|
|
125
125
|
});
|
126
126
|
```
|
127
127
|
|
128
|
+
```js
|
129
|
+
// GET request for remote image
|
130
|
+
axios({
|
131
|
+
method:'get',
|
132
|
+
url:'http://bit.ly/2mTM3nY',
|
133
|
+
responseType:'stream'
|
134
|
+
})
|
135
|
+
.then(function(response) {
|
136
|
+
response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
|
137
|
+
});
|
138
|
+
```
|
139
|
+
|
128
140
|
##### axios(url[, config])
|
129
141
|
|
130
142
|
```js
|
@@ -201,8 +213,10 @@ These are the available config options for making requests. Only the `url` is re
|
|
201
213
|
|
202
214
|
// `transformRequest` allows changes to the request data before it is sent to the server
|
203
215
|
// This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
204
|
-
// The last function in the array must return a string
|
205
|
-
|
216
|
+
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
|
217
|
+
// FormData or Stream
|
218
|
+
// You may modify the headers object.
|
219
|
+
transformRequest: [function (data, headers) {
|
206
220
|
// Do whatever you want to transform the data
|
207
221
|
|
208
222
|
return data;
|
@@ -236,7 +250,7 @@ These are the available config options for making requests. Only the `url` is re
|
|
236
250
|
// When no `transformRequest` is set, must be of one of the following types:
|
237
251
|
// - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
|
238
252
|
// - Browser only: FormData, File, Blob
|
239
|
-
// - Node only: Stream
|
253
|
+
// - Node only: Stream, Buffer
|
240
254
|
data: {
|
241
255
|
firstName: 'Fred'
|
242
256
|
},
|
@@ -299,14 +313,17 @@ These are the available config options for making requests. Only the `url` is re
|
|
299
313
|
maxRedirects: 5, // default
|
300
314
|
|
301
315
|
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
|
302
|
-
// and https requests, respectively, in node.js. This allows to
|
316
|
+
// and https requests, respectively, in node.js. This allows options to be added like
|
303
317
|
// `keepAlive` that are not enabled by default.
|
304
318
|
httpAgent: new http.Agent({ keepAlive: true }),
|
305
319
|
httpsAgent: new https.Agent({ keepAlive: true }),
|
306
320
|
|
307
321
|
// 'proxy' defines the hostname and port of the proxy server
|
308
|
-
// `
|
309
|
-
//
|
322
|
+
// Use `false` to disable proxies, ignoring environment variables.
|
323
|
+
// `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
|
324
|
+
// supplies credentials.
|
325
|
+
// This will set an `Proxy-Authorization` header, overwriting any existing
|
326
|
+
// `Proxy-Authorization` custom headers you have set using `headers`.
|
310
327
|
proxy: {
|
311
328
|
host: '127.0.0.1',
|
312
329
|
port: 9000,
|
@@ -339,10 +356,16 @@ The response for a request contains the following information.
|
|
339
356
|
statusText: 'OK',
|
340
357
|
|
341
358
|
// `headers` the headers that the server responded with
|
359
|
+
// All header names are lower cased
|
342
360
|
headers: {},
|
343
361
|
|
344
362
|
// `config` is the config that was provided to `axios` for the request
|
345
|
-
config: {}
|
363
|
+
config: {},
|
364
|
+
|
365
|
+
// `request` is the request that generated this response
|
366
|
+
// It is the last ClientRequest instance in node.js (in redirects)
|
367
|
+
// and an XMLHttpRequest instance the browser
|
368
|
+
request: {}
|
346
369
|
}
|
347
370
|
```
|
348
371
|
|
@@ -448,11 +471,16 @@ instance.interceptors.request.use(function () {/*...*/});
|
|
448
471
|
axios.get('/user/12345')
|
449
472
|
.catch(function (error) {
|
450
473
|
if (error.response) {
|
451
|
-
// The request was made
|
474
|
+
// The request was made and the server responded with a status code
|
452
475
|
// that falls out of the range of 2xx
|
453
476
|
console.log(error.response.data);
|
454
477
|
console.log(error.response.status);
|
455
478
|
console.log(error.response.headers);
|
479
|
+
} else if (error.request) {
|
480
|
+
// The request was made but no response was received
|
481
|
+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
482
|
+
// http.ClientRequest in node.js
|
483
|
+
console.log(error.request);
|
456
484
|
} else {
|
457
485
|
// Something happened in setting up the request that triggered an Error
|
458
486
|
console.log('Error', error.message);
|
@@ -528,10 +556,10 @@ In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/
|
|
528
556
|
var params = new URLSearchParams();
|
529
557
|
params.append('param1', 'value1');
|
530
558
|
params.append('param2', 'value2');
|
531
|
-
axios.post('/foo', params);
|
559
|
+
axios.post('/foo', params);
|
532
560
|
```
|
533
561
|
|
534
|
-
> Note that `URLSearchParams` is not supported by all browsers, but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
|
562
|
+
> Note that `URLSearchParams` is not supported by all browsers (see [caniuse.com](http://www.caniuse.com/#feat=urlsearchparams)), but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
|
535
563
|
|
536
564
|
Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
|
537
565
|
|
@@ -549,7 +577,7 @@ var querystring = require('querystring');
|
|
549
577
|
axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
|
550
578
|
```
|
551
579
|
|
552
|
-
You can also use the `qs` library.
|
580
|
+
You can also use the [`qs`](https://github.com/ljharb/qs) library.
|
553
581
|
|
554
582
|
## Semver
|
555
583
|
|
@@ -569,11 +597,11 @@ axios.get('/user?ID=12345');
|
|
569
597
|
|
570
598
|
## Resources
|
571
599
|
|
572
|
-
* [Changelog](https://github.com/
|
573
|
-
* [Upgrade Guide](https://github.com/
|
574
|
-
* [Ecosystem](https://github.com/
|
575
|
-
* [Contributing Guide](https://github.com/
|
576
|
-
* [Code of Conduct](https://github.com/
|
600
|
+
* [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
|
601
|
+
* [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md)
|
602
|
+
* [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md)
|
603
|
+
* [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md)
|
604
|
+
* [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
|
577
605
|
|
578
606
|
## Credits
|
579
607
|
|
package/UPGRADE_GUIDE.md
CHANGED
@@ -115,8 +115,8 @@ function myAdapter(config) {
|
|
115
115
|
```
|
116
116
|
|
117
117
|
See the related commits for more details:
|
118
|
-
- [Response transformers](https://github.com/
|
119
|
-
- [Request adapter Promise](https://github.com/
|
118
|
+
- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
|
119
|
+
- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
|
120
120
|
|
121
121
|
### 0.5.x -> 0.6.0
|
122
122
|
|
@@ -135,7 +135,7 @@ This will polyfill the global environment, and only needs to be done once.
|
|
135
135
|
|
136
136
|
#### `axios.success`/`axios.error`
|
137
137
|
|
138
|
-
The `success`, and `error` aliases were deprectated in [0.4.0](https://github.com/
|
138
|
+
The `success`, and `error` aliases were deprectated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively.
|
139
139
|
|
140
140
|
```js
|
141
141
|
axios.get('some/url')
|