axios 0.18.0 → 0.18.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.

@@ -6,7 +6,6 @@ var buildURL = require('./../helpers/buildURL');
6
6
  var parseHeaders = require('./../helpers/parseHeaders');
7
7
  var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
8
8
  var createError = require('../core/createError');
9
- var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || require('./../helpers/btoa');
10
9
 
11
10
  module.exports = function xhrAdapter(config) {
12
11
  return new Promise(function dispatchXhrRequest(resolve, reject) {
@@ -18,22 +17,6 @@ module.exports = function xhrAdapter(config) {
18
17
  }
19
18
 
20
19
  var request = new XMLHttpRequest();
21
- var loadEvent = 'onreadystatechange';
22
- var xDomain = false;
23
-
24
- // For IE 8/9 CORS support
25
- // Only supports POST and GET calls and doesn't returns the response headers.
26
- // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
27
- if (process.env.NODE_ENV !== 'test' &&
28
- typeof window !== 'undefined' &&
29
- window.XDomainRequest && !('withCredentials' in request) &&
30
- !isURLSameOrigin(config.url)) {
31
- request = new window.XDomainRequest();
32
- loadEvent = 'onload';
33
- xDomain = true;
34
- request.onprogress = function handleProgress() {};
35
- request.ontimeout = function handleTimeout() {};
36
- }
37
20
 
38
21
  // HTTP basic authentication
39
22
  if (config.auth) {
@@ -48,8 +31,8 @@ module.exports = function xhrAdapter(config) {
48
31
  request.timeout = config.timeout;
49
32
 
50
33
  // Listen for ready state
51
- request[loadEvent] = function handleLoad() {
52
- if (!request || (request.readyState !== 4 && !xDomain)) {
34
+ request.onreadystatechange = function handleLoad() {
35
+ if (!request || request.readyState !== 4) {
53
36
  return;
54
37
  }
55
38
 
@@ -66,9 +49,8 @@ module.exports = function xhrAdapter(config) {
66
49
  var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
67
50
  var response = {
68
51
  data: responseData,
69
- // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201)
70
- status: request.status === 1223 ? 204 : request.status,
71
- statusText: request.status === 1223 ? 'No Content' : request.statusText,
52
+ status: request.status,
53
+ statusText: request.statusText,
72
54
  headers: responseHeaders,
73
55
  config: config,
74
56
  request: request
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -71,8 +71,8 @@
71
71
  },
72
72
  "typings": "./index.d.ts",
73
73
  "dependencies": {
74
- "follow-redirects": "^1.3.0",
75
- "is-buffer": "^1.1.5"
74
+ "follow-redirects": "1.5.10",
75
+ "is-buffer": "^2.0.2"
76
76
  },
77
77
  "bundlesize": [
78
78
  {
@@ -1,36 +0,0 @@
1
- 'use strict';
2
-
3
- // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
4
-
5
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
6
-
7
- function E() {
8
- this.message = 'String contains an invalid character';
9
- }
10
- E.prototype = new Error;
11
- E.prototype.code = 5;
12
- E.prototype.name = 'InvalidCharacterError';
13
-
14
- function btoa(input) {
15
- var str = String(input);
16
- var output = '';
17
- for (
18
- // initialize result and counter
19
- var block, charCode, idx = 0, map = chars;
20
- // if the next str index does not exist:
21
- // change the mapping table to "="
22
- // check if d has no fractional digits
23
- str.charAt(idx | 0) || (map = '=', idx % 1);
24
- // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
25
- output += map.charAt(63 & block >> 8 - idx % 1 * 8)
26
- ) {
27
- charCode = str.charCodeAt(idx += 3 / 4);
28
- if (charCode > 0xFF) {
29
- throw new E();
30
- }
31
- block = block << 8 | charCode;
32
- }
33
- return output;
34
- }
35
-
36
- module.exports = btoa;