axios 0.14.0 → 0.15.3

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 CHANGED
@@ -1,11 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ### 0.15.3 (Nov 27, 2016)
4
+
5
+ - Fixing issue with custom instances and global defaults ([#443](https://github.com/mzabriskie/axios/issues/443))
6
+ - Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/mzabriskie/axios/issues/519))
7
+ - Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/mzabriskie/axios/issues/509))
8
+ - Fixing issue with `btoa` and IE ([#507](https://github.com/mzabriskie/axios/issues/507))
9
+ - Adding support for proxy authentication ([#483](https://github.com/mzabriskie/axios/pull/483))
10
+ - Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/mzabriskie/axios/pull/493))
11
+ - Fixing proxy issues ([#491](https://github.com/mzabriskie/axios/pull/491))
12
+
13
+ ### 0.15.2 (Oct 17, 2016)
14
+
15
+ - Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/mzabriskie/axios/issues/482))
16
+
17
+ ### 0.15.1 (Oct 14, 2016)
18
+
19
+ - Fixing issue with UMD ([#485](https://github.com/mzabriskie/axios/issues/485))
20
+
21
+ ### 0.15.0 (Oct 10, 2016)
22
+
23
+ - Adding cancellation support ([#452](https://github.com/mzabriskie/axios/pull/452))
24
+ - Moving default adapter to global defaults ([#437](https://github.com/mzabriskie/axios/pull/437))
25
+ - Fixing issue with `file` URI scheme ([#440](https://github.com/mzabriskie/axios/pull/440))
26
+ - Fixing issue with `params` objects that have no prototype ([#445](https://github.com/mzabriskie/axios/pull/445))
27
+
3
28
  ### 0.14.0 (Aug 27, 2016)
4
29
 
5
- - Updating TypeScript definitions ([#419](https://github.com/mzabriskie/axios/pull/419))
30
+ - **BREAKING** Updating TypeScript definitions ([#419](https://github.com/mzabriskie/axios/pull/419))
31
+ - **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/mzabriskie/axios/pull/387))
32
+ - **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/mzabriskie/axios/pull/423))
6
33
  - Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/mzabriskie/axios/pull/366))
7
- - Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/mzabriskie/axios/pull/387))
8
- - Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/mzabriskie/axios/pull/423))
9
34
  - Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/mzabriskie/axios/pull/397))
10
35
  - Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/mzabriskie/axios/pull/406))
11
36
 
@@ -15,13 +40,13 @@
15
40
 
16
41
  ### 0.13.0 (Jul 13, 2016)
17
42
 
18
- - Improved error handling ([#345](https://github.com/mzabriskie/axios/pull/345))
43
+ - **BREAKING** Improved error handling ([#345](https://github.com/mzabriskie/axios/pull/345))
44
+ - **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/mzabriskie/axios/commit/10eb23865101f9347570552c04e9d6211376e25e))
45
+ - **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/mzabriskie/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a))
19
46
  - Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/mzabriskie/axios/issues/343))
20
47
  - Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/mzabriskie/axios/issues/352))
21
48
  - Fixing custom instance defaults ([#341](https://github.com/mzabriskie/axios/issues/341))
22
49
  - Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/mzabriskie/axios/issues/217))
23
- - Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/mzabriskie/axios/commit/10eb23865101f9347570552c04e9d6211376e25e))
24
- - Request adapters now return a `Promise` ([157efd5](https://github.com/mzabriskie/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a))
25
50
 
26
51
  ### 0.12.0 (May 31, 2016)
27
52
 
package/README.md ADDED
@@ -0,0 +1,582 @@
1
+ # axios
2
+
3
+ [![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
4
+ [![build status](https://img.shields.io/travis/mzabriskie/axios.svg?style=flat-square)](https://travis-ci.org/mzabriskie/axios)
5
+ [![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
6
+ [![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](http://npm-stat.com/charts.html?package=axios)
7
+ [![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
8
+
9
+ Promise based HTTP client for the browser and node.js
10
+
11
+ ## Features
12
+
13
+ - Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser
14
+ - Make [http](http://nodejs.org/api/http.html) requests from node.js
15
+ - Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API
16
+ - Intercept request and response
17
+ - Transform request and response data
18
+ - Cancel requests
19
+ - Automatic transforms for JSON data
20
+ - Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
21
+
22
+ ## Browser Support
23
+
24
+ ![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) |
25
+ --- | --- | --- | --- | --- | --- |
26
+ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 8+ ✔ |
27
+
28
+ [![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
29
+
30
+ ## Installing
31
+
32
+ Using npm:
33
+
34
+ ```bash
35
+ $ npm install axios
36
+ ```
37
+
38
+ Using bower:
39
+
40
+ ```bash
41
+ $ bower install axios
42
+ ```
43
+
44
+ Using cdn:
45
+
46
+ ```html
47
+ <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
48
+ ```
49
+
50
+ ## Example
51
+
52
+ Performing a `GET` request
53
+
54
+ ```js
55
+ // Make a request for a user with a given ID
56
+ axios.get('/user?ID=12345')
57
+ .then(function (response) {
58
+ console.log(response);
59
+ })
60
+ .catch(function (error) {
61
+ console.log(error);
62
+ });
63
+
64
+ // Optionally the request above could also be done as
65
+ axios.get('/user', {
66
+ params: {
67
+ ID: 12345
68
+ }
69
+ })
70
+ .then(function (response) {
71
+ console.log(response);
72
+ })
73
+ .catch(function (error) {
74
+ console.log(error);
75
+ });
76
+ ```
77
+
78
+ Performing a `POST` request
79
+
80
+ ```js
81
+ axios.post('/user', {
82
+ firstName: 'Fred',
83
+ lastName: 'Flintstone'
84
+ })
85
+ .then(function (response) {
86
+ console.log(response);
87
+ })
88
+ .catch(function (error) {
89
+ console.log(error);
90
+ });
91
+ ```
92
+
93
+ Performing multiple concurrent requests
94
+
95
+ ```js
96
+ function getUserAccount() {
97
+ return axios.get('/user/12345');
98
+ }
99
+
100
+ function getUserPermissions() {
101
+ return axios.get('/user/12345/permissions');
102
+ }
103
+
104
+ axios.all([getUserAccount(), getUserPermissions()])
105
+ .then(axios.spread(function (acct, perms) {
106
+ // Both requests are now complete
107
+ }));
108
+ ```
109
+
110
+ ## axios API
111
+
112
+ Requests can be made by passing the relevant config to `axios`.
113
+
114
+ ##### axios(config)
115
+
116
+ ```js
117
+ // Send a POST request
118
+ axios({
119
+ method: 'post',
120
+ url: '/user/12345',
121
+ data: {
122
+ firstName: 'Fred',
123
+ lastName: 'Flintstone'
124
+ }
125
+ });
126
+ ```
127
+
128
+ ##### axios(url[, config])
129
+
130
+ ```js
131
+ // Send a GET request (default method)
132
+ axios('/user/12345');
133
+ ```
134
+
135
+ ### Request method aliases
136
+
137
+ For convenience aliases have been provided for all supported request methods.
138
+
139
+ ##### axios.request(config)
140
+ ##### axios.get(url[, config])
141
+ ##### axios.delete(url[, config])
142
+ ##### axios.head(url[, config])
143
+ ##### axios.post(url[, data[, config]])
144
+ ##### axios.put(url[, data[, config]])
145
+ ##### axios.patch(url[, data[, config]])
146
+
147
+ ###### NOTE
148
+ When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
149
+
150
+ ### Concurrency
151
+
152
+ Helper functions for dealing with concurrent requests.
153
+
154
+ ##### axios.all(iterable)
155
+ ##### axios.spread(callback)
156
+
157
+ ### Creating an instance
158
+
159
+ You can create a new instance of axios with a custom config.
160
+
161
+ ##### axios.create([config])
162
+
163
+ ```js
164
+ var instance = axios.create({
165
+ baseURL: 'https://some-domain.com/api/',
166
+ timeout: 1000,
167
+ headers: {'X-Custom-Header': 'foobar'}
168
+ });
169
+ ```
170
+
171
+ ### Instance methods
172
+
173
+ The available instance methods are listed below. The specified config will be merged with the instance config.
174
+
175
+ ##### axios#request(config)
176
+ ##### axios#get(url[, config])
177
+ ##### axios#delete(url[, config])
178
+ ##### axios#head(url[, config])
179
+ ##### axios#post(url[, data[, config]])
180
+ ##### axios#put(url[, data[, config]])
181
+ ##### axios#patch(url[, data[, config]])
182
+
183
+ ## Request Config
184
+
185
+ These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
186
+
187
+ ```js
188
+ {
189
+ // `url` is the server URL that will be used for the request
190
+ url: '/user',
191
+
192
+ // `method` is the request method to be used when making the request
193
+ method: 'get', // default
194
+
195
+ // `baseURL` will be prepended to `url` unless `url` is absolute.
196
+ // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
197
+ // to methods of that instance.
198
+ baseURL: 'https://some-domain.com/api/',
199
+
200
+ // `transformRequest` allows changes to the request data before it is sent to the server
201
+ // This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
202
+ // The last function in the array must return a string, an ArrayBuffer, or a Stream
203
+ transformRequest: [function (data) {
204
+ // Do whatever you want to transform the data
205
+
206
+ return data;
207
+ }],
208
+
209
+ // `transformResponse` allows changes to the response data to be made before
210
+ // it is passed to then/catch
211
+ transformResponse: [function (data) {
212
+ // Do whatever you want to transform the data
213
+
214
+ return data;
215
+ }],
216
+
217
+ // `headers` are custom headers to be sent
218
+ headers: {'X-Requested-With': 'XMLHttpRequest'},
219
+
220
+ // `params` are the URL parameters to be sent with the request
221
+ // Must be a plain object or a URLSearchParams object
222
+ params: {
223
+ ID: 12345
224
+ },
225
+
226
+ // `paramsSerializer` is an optional function in charge of serializing `params`
227
+ // (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
228
+ paramsSerializer: function(params) {
229
+ return Qs.stringify(params, {arrayFormat: 'brackets'})
230
+ },
231
+
232
+ // `data` is the data to be sent as the request body
233
+ // Only applicable for request methods 'PUT', 'POST', and 'PATCH'
234
+ // When no `transformRequest` is set, must be of one of the following types:
235
+ // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
236
+ // - Browser only: FormData, File, Blob
237
+ // - Node only: Stream
238
+ data: {
239
+ firstName: 'Fred'
240
+ },
241
+
242
+ // `timeout` specifies the number of milliseconds before the request times out.
243
+ // If the request takes longer than `timeout`, the request will be aborted.
244
+ timeout: 1000,
245
+
246
+ // `withCredentials` indicates whether or not cross-site Access-Control requests
247
+ // should be made using credentials
248
+ withCredentials: false, // default
249
+
250
+ // `adapter` allows custom handling of requests which makes testing easier.
251
+ // Return a promise and supply a valid response (see [response docs](#response-api)).
252
+ adapter: function (config) {
253
+ /* ... */
254
+ },
255
+
256
+ // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
257
+ // This will set an `Authorization` header, overwriting any existing
258
+ // `Authorization` custom headers you have set using `headers`.
259
+ auth: {
260
+ username: 'janedoe',
261
+ password: 's00pers3cret'
262
+ },
263
+
264
+ // `responseType` indicates the type of data that the server will respond with
265
+ // options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'
266
+ responseType: 'json', // default
267
+
268
+ // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
269
+ xsrfCookieName: 'XSRF-TOKEN', // default
270
+
271
+ // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
272
+ xsrfHeaderName: 'X-XSRF-TOKEN', // default
273
+
274
+ // `onUploadProgress` allows handling of progress events for uploads
275
+ onUploadProgress: function (progressEvent) {
276
+ // Do whatever you want with the native progress event
277
+ },
278
+
279
+ // `onDownloadProgress` allows handling of progress events for downloads
280
+ onDownloadProgress: function (progressEvent) {
281
+ // Do whatever you want with the native progress event
282
+ },
283
+
284
+ // `maxContentLength` defines the max size of the http response content allowed
285
+ maxContentLength: 2000,
286
+
287
+ // `validateStatus` defines whether to resolve or reject the promise for a given
288
+ // HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
289
+ // or `undefined`), the promise will be resolved; otherwise, the promise will be
290
+ // rejected.
291
+ validateStatus: function (status) {
292
+ return status >= 200 && status < 300; // default
293
+ },
294
+
295
+ // `maxRedirects` defines the maximum number of redirects to follow in node.js.
296
+ // If set to 0, no redirects will be followed.
297
+ maxRedirects: 5, // default
298
+
299
+ // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
300
+ // and https requests, respectively, in node.js. This allows to configure options like
301
+ // `keepAlive` that are not enabled by default.
302
+ httpAgent: new http.Agent({ keepAlive: true }),
303
+ httpsAgent: new https.Agent({ keepAlive: true }),
304
+
305
+ // 'proxy' defines the hostname and port of the proxy server
306
+ // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and supplies credentials.
307
+ // This will set an `Proxy-Authorization` header, overwriting any existing `Proxy-Authorization` custom headers you have set using `headers`.
308
+ proxy: {
309
+ host: '127.0.0.1',
310
+ port: 9000,
311
+ auth: : {
312
+ username: 'mikeymike',
313
+ password: 'rapunz3l'
314
+ }
315
+ },
316
+
317
+ // `cancelToken` specifies a cancel token that can be used to cancel the request
318
+ // (see Cancellation section below for details)
319
+ cancelToken: new CancelToken(function (cancel) {
320
+ })
321
+ }
322
+ ```
323
+
324
+ ## Response Schema
325
+
326
+ The response for a request contains the following information.
327
+
328
+ ```js
329
+ {
330
+ // `data` is the response that was provided by the server
331
+ data: {},
332
+
333
+ // `status` is the HTTP status code from the server response
334
+ status: 200,
335
+
336
+ // `statusText` is the HTTP status message from the server response
337
+ statusText: 'OK',
338
+
339
+ // `headers` the headers that the server responded with
340
+ headers: {},
341
+
342
+ // `config` is the config that was provided to `axios` for the request
343
+ config: {}
344
+ }
345
+ ```
346
+
347
+ When using `then`, you will receive the response as follows:
348
+
349
+ ```js
350
+ axios.get('/user/12345')
351
+ .then(function(response) {
352
+ console.log(response.data);
353
+ console.log(response.status);
354
+ console.log(response.statusText);
355
+ console.log(response.headers);
356
+ console.log(response.config);
357
+ });
358
+ ```
359
+
360
+ When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
361
+
362
+ ## Config Defaults
363
+
364
+ You can specify config defaults that will be applied to every request.
365
+
366
+ ### Global axios defaults
367
+
368
+ ```js
369
+ axios.defaults.baseURL = 'https://api.example.com';
370
+ axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
371
+ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
372
+ ```
373
+
374
+ ### Custom instance defaults
375
+
376
+ ```js
377
+ // Set config defaults when creating the instance
378
+ var instance = axios.create({
379
+ baseURL: 'https://api.example.com'
380
+ });
381
+
382
+ // Alter defaults after instance has been created
383
+ instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
384
+ ```
385
+
386
+ ### Config order of precedence
387
+
388
+ Config will be merged with an order of precedence. The order is library defaults found in `lib/defaults.js`, then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
389
+
390
+ ```js
391
+ // Create an instance using the config defaults provided by the library
392
+ // At this point the timeout config value is `0` as is the default for the library
393
+ var instance = axios.create();
394
+
395
+ // Override timeout default for the library
396
+ // Now all requests will wait 2.5 seconds before timing out
397
+ instance.defaults.timeout = 2500;
398
+
399
+ // Override timeout for this request as it's known to take a long time
400
+ instance.get('/longRequest', {
401
+ timeout: 5000
402
+ });
403
+ ```
404
+
405
+ ## Interceptors
406
+
407
+ You can intercept requests or responses before they are handled by `then` or `catch`.
408
+
409
+ ```js
410
+ // Add a request interceptor
411
+ axios.interceptors.request.use(function (config) {
412
+ // Do something before request is sent
413
+ return config;
414
+ }, function (error) {
415
+ // Do something with request error
416
+ return Promise.reject(error);
417
+ });
418
+
419
+ // Add a response interceptor
420
+ axios.interceptors.response.use(function (response) {
421
+ // Do something with response data
422
+ return response;
423
+ }, function (error) {
424
+ // Do something with response error
425
+ return Promise.reject(error);
426
+ });
427
+ ```
428
+
429
+ If you may need to remove an interceptor later you can.
430
+
431
+ ```js
432
+ var myInterceptor = axios.interceptors.request.use(function () {/*...*/});
433
+ axios.interceptors.request.eject(myInterceptor);
434
+ ```
435
+
436
+ You can add interceptors to a custom instance of axios.
437
+
438
+ ```js
439
+ var instance = axios.create();
440
+ instance.interceptors.request.use(function () {/*...*/});
441
+ ```
442
+
443
+ ## Handling Errors
444
+
445
+ ```js
446
+ axios.get('/user/12345')
447
+ .catch(function (error) {
448
+ if (error.response) {
449
+ // The request was made, but the server responded with a status code
450
+ // that falls out of the range of 2xx
451
+ console.log(error.response.data);
452
+ console.log(error.response.status);
453
+ console.log(error.response.headers);
454
+ } else {
455
+ // Something happened in setting up the request that triggered an Error
456
+ console.log('Error', error.message);
457
+ }
458
+ console.log(error.config);
459
+ });
460
+ ```
461
+
462
+ You can define a custom HTTP status code error range using the `validateStatus` config option.
463
+
464
+ ```js
465
+ axios.get('/user/12345', {
466
+ validateStatus: function (status) {
467
+ return status < 500; // Reject only if the status code is greater than or equal to 500
468
+ }
469
+ })
470
+ ```
471
+
472
+ ## Cancellation
473
+
474
+ You can cancel a request using a *cancel token*.
475
+
476
+ > The axios cancel token API is based on the [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises), which is currently at Stage 1.
477
+
478
+ You can create a cancel token using the `CancelToken.source` factory as shown below:
479
+
480
+ ```js
481
+ var CancelToken = axios.CancelToken;
482
+ var source = CancelToken.source();
483
+
484
+ axios.get('/user/12345', {
485
+ cancelToken: source.token
486
+ }).catch(function(thrown) {
487
+ if (axios.isCancel(thrown)) {
488
+ console.log('Request canceled', thrown.message);
489
+ } else {
490
+ // handle error
491
+ }
492
+ });
493
+
494
+ // cancel the request (the message parameter is optional)
495
+ source.cancel('Operation canceled by the user.');
496
+ ```
497
+
498
+ You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
499
+
500
+ ```js
501
+ var CancelToken = axios.CancelToken;
502
+ var cancel;
503
+
504
+ axios.get('/user/12345', {
505
+ cancelToken: new CancelToken(function executor(c) {
506
+ // An executor function receives a cancel function as a parameter
507
+ cancel = c;
508
+ })
509
+ });
510
+
511
+ // cancel the request
512
+ cancel();
513
+ ```
514
+
515
+ > Note: you can cancel several requests with the same cancel token.
516
+
517
+ ## Using application/x-www-form-urlencoded format
518
+
519
+ By default, axios serializes JavaScript objects to `JSON`. To send data in the `application/x-www-form-urlencoded` format instead, you can use one of the following options.
520
+
521
+ ### Browser
522
+
523
+ In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows:
524
+
525
+ ```js
526
+ var params = new URLSearchParams();
527
+ params.append('param1', 'value1');
528
+ params.append('param2', 'value2');
529
+ axios.post('/foo', params);
530
+ ```
531
+
532
+ > 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).
533
+
534
+ Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
535
+
536
+ ```js
537
+ var qs = require('qs');
538
+ axios.post('/foo', qs.stringify({ 'bar': 123 });
539
+ ```
540
+
541
+ ### Node.js
542
+
543
+ In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
544
+
545
+ ```js
546
+ var querystring = require('querystring');
547
+ axios.post('http://something.com/', querystring.stringify({ foo: 'bar' });
548
+ ```
549
+
550
+ You can also use the `qs` library.
551
+
552
+ ## Semver
553
+
554
+ Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
555
+
556
+ ## Promises
557
+
558
+ axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
559
+ If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
560
+
561
+ ## TypeScript
562
+ axios includes [TypeScript](http://typescriptlang.org) definitions.
563
+ ```typescript
564
+ import axios from 'axios';
565
+ axios.get('/user?ID=12345');
566
+ ```
567
+
568
+ ## Resources
569
+
570
+ * [Changelog](https://github.com/mzabriskie/axios/blob/master/CHANGELOG.md)
571
+ * [Upgrade Guide](https://github.com/mzabriskie/axios/blob/master/UPGRADE_GUIDE.md)
572
+ * [Ecosystem](https://github.com/mzabriskie/axios/blob/master/ECOSYSTEM.md)
573
+ * [Contributing Guide](https://github.com/mzabriskie/axios/blob/master/CONTRIBUTING.md)
574
+ * [Code of Conduct](https://github.com/mzabriskie/axios/blob/master/CODE_OF_CONDUCT.md)
575
+
576
+ ## Credits
577
+
578
+ axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [Angular](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of Angular.
579
+
580
+ ## License
581
+
582
+ MIT