axios
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -1,2 +0,2 @@ | ||
// Type definitions for Axios v0.8.0 | ||
// Type definitions for Axios v0.8.1 | ||
// Project: https://github.com/mzabriskie/axios | ||
@@ -3,0 +3,0 @@ |
132
CHANGELOG.md
# Changelog | ||
### 0.1.0 (Aug 29, 2014) | ||
### 0.8.1 (Dec 14, 2015) | ||
- Initial release | ||
- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/mzabriskie/axios/pull/168)) | ||
- Fixing error with format of basic auth header ([#178](https://github.com/mzabriskie/axios/pull/173)) | ||
- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/mzabriskie/axios/pull/174)) | ||
### 0.2.0 (Sep 12, 2014) | ||
### 0.8.0 (Dec 11, 2015) | ||
- Adding support for `all` and `spread` | ||
- Adding support for node.js ([#1](https://github.com/mzabriskie/axios/issues/1)) | ||
- Adding support for creating instances of axios ([#123](https://github.com/mzabriskie/axios/pull/123)) | ||
- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/mzabriskie/axios/pull/128)) | ||
- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/mzabriskie/axios/pull/121)) | ||
- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/mzabriskie/axios/pull/127)) | ||
- Adding support for following redirects in node ([#146](https://github.com/mzabriskie/axios/pull/146)) | ||
- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/mzabriskie/axios/pull/149)) | ||
- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/mzabriskie/axios/pull/140)) | ||
- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/mzabriskie/axios/pull/167)) | ||
- Adding support for baseURL option ([#160](https://github.com/mzabriskie/axios/pull/160)) | ||
### 0.2.1 (Sep 12, 2014) | ||
### 0.7.0 (Sep 29, 2015) | ||
- Fixing build problem causing ridiculous file sizes | ||
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/mzabriskie/axios/pull/87)) | ||
- Adding support for passing agent in node ([#102](https://github.com/mzabriskie/axios/pull/102)) | ||
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/mzabriskie/axios/pull/106)) | ||
- Fixing typescript definition ([#105](https://github.com/mzabriskie/axios/pull/105)) | ||
- Fixing default timeout config for node ([#112](https://github.com/mzabriskie/axios/pull/112)) | ||
- Adding support for use in web workers, and react-native ([#70](https://github.com/mzabriskie/axios/issue/70)), ([#98](https://github.com/mzabriskie/axios/pull/98)) | ||
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/mzabriskie/axios/issues/116)) | ||
### 0.2.2 (Sep 14, 2014) | ||
### 0.6.0 (Sep 21, 2015) | ||
- Fixing bundling with browserify ([#4](https://github.com/mzabriskie/axios/issues/4)) | ||
- Removing deprecated success/error aliases | ||
- Fixing issue with array params not being properly encoded ([#49](https://github.com/mzabriskie/axios/pull/49)) | ||
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/mzabriskie/axios/issues/69)) | ||
- Adding support for timeout config ([#56](https://github.com/mzabriskie/axios/issues/56)) | ||
- Removing es6-promise dependency | ||
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/mzabriskie/axios/pull/91)) | ||
- Fixing issue with IE8 ([#85](https://github.com/mzabriskie/axios/pull/85)) | ||
- Converting build to UMD | ||
### 0.3.0 (Sep 16, 2014) | ||
### 0.5.4 (Apr 08, 2015) | ||
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/mzabriskie/axios/issues/8)) | ||
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/mzabriskie/axios/issues/6)) | ||
- Fixing issue with `all` not working ([#7](https://github.com/mzabriskie/axios/issues/7)) | ||
- Fixing issue with FormData not being sent ([#53](https://github.com/mzabriskie/axios/issues/53)) | ||
### 0.3.1 (Sep 16, 2014) | ||
### 0.5.3 (Apr 07, 2015) | ||
- Fixing missing post body when using node.js ([#3](https://github.com/mzabriskie/axios/issues/3)) | ||
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/mzabriskie/axios/issues/55)) | ||
### 0.4.0 (Oct 03, 2014) | ||
### 0.5.2 (Mar 13, 2015) | ||
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/mzabriskie/axios/issues/10)) | ||
- Adding support for utf-8 for node.js ([#13](https://github.com/mzabriskie/axios/issues/13)) | ||
- Adding support for SSL for node.js ([#12](https://github.com/mzabriskie/axios/issues/12)) | ||
- Fixing incorrect `Content-Type` header ([#9](https://github.com/mzabriskie/axios/issues/9)) | ||
- Adding standalone build without bundled es6-promise ([#11](https://github.com/mzabriskie/axios/issues/11)) | ||
- Deprecating `success`/`error` in favor of `then`/`catch` | ||
- Adding support for `statusText` in response ([#46](https://github.com/mzabriskie/axios/issues/46)) | ||
### 0.4.1 (Oct 15, 2014) | ||
### 0.5.1 (Mar 10, 2015) | ||
- Adding error handling to request for node.js ([#18](https://github.com/mzabriskie/axios/issues/18)) | ||
- Fixing issue using strict mode ([#45](https://github.com/mzabriskie/axios/issues/45)) | ||
- Fixing issue with standalone build ([#47](https://github.com/mzabriskie/axios/issues/47)) | ||
### 0.5.0 (Jan 23, 2015) | ||
- Adding support for intercepetors ([#14](https://github.com/mzabriskie/axios/issues/14)) | ||
- Updating es6-promise dependency | ||
### 0.4.2 (Dec 10, 2014) | ||
@@ -50,55 +71,40 @@ | ||
### 0.5.0 (Jan 23, 2015) | ||
### 0.4.1 (Oct 15, 2014) | ||
- Adding support for intercepetors ([#14](https://github.com/mzabriskie/axios/issues/14)) | ||
- Updating es6-promise dependency | ||
- Adding error handling to request for node.js ([#18](https://github.com/mzabriskie/axios/issues/18)) | ||
### 0.5.1 (Mar 10, 2015) | ||
### 0.4.0 (Oct 03, 2014) | ||
- Fixing issue using strict mode ([#45](https://github.com/mzabriskie/axios/issues/45)) | ||
- Fixing issue with standalone build ([#47](https://github.com/mzabriskie/axios/issues/47)) | ||
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/mzabriskie/axios/issues/10)) | ||
- Adding support for utf-8 for node.js ([#13](https://github.com/mzabriskie/axios/issues/13)) | ||
- Adding support for SSL for node.js ([#12](https://github.com/mzabriskie/axios/issues/12)) | ||
- Fixing incorrect `Content-Type` header ([#9](https://github.com/mzabriskie/axios/issues/9)) | ||
- Adding standalone build without bundled es6-promise ([#11](https://github.com/mzabriskie/axios/issues/11)) | ||
- Deprecating `success`/`error` in favor of `then`/`catch` | ||
### 0.5.2 (Mar 13, 2015) | ||
### 0.3.1 (Sep 16, 2014) | ||
- Adding support for `statusText` in response ([#46](https://github.com/mzabriskie/axios/issues/46)) | ||
- Fixing missing post body when using node.js ([#3](https://github.com/mzabriskie/axios/issues/3)) | ||
### 0.5.3 (Apr 07, 2015) | ||
### 0.3.0 (Sep 16, 2014) | ||
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/mzabriskie/axios/issues/55)) | ||
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/mzabriskie/axios/issues/8)) | ||
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/mzabriskie/axios/issues/6)) | ||
- Fixing issue with `all` not working ([#7](https://github.com/mzabriskie/axios/issues/7)) | ||
### 0.5.4 (Apr 08, 2015) | ||
### 0.2.2 (Sep 14, 2014) | ||
- Fixing issue with FormData not being sent ([#53](https://github.com/mzabriskie/axios/issues/53)) | ||
- Fixing bundling with browserify ([#4](https://github.com/mzabriskie/axios/issues/4)) | ||
### 0.6.0 (Sep 21, 2015) | ||
### 0.2.1 (Sep 12, 2014) | ||
- Removing deprecated success/error aliases | ||
- Fixing issue with array params not being properly encoded ([#49](https://github.com/mzabriskie/axios/pull/49)) | ||
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/mzabriskie/axios/issues/69)) | ||
- Adding support for timeout config ([#56](https://github.com/mzabriskie/axios/issues/56)) | ||
- Removing es6-promise dependency | ||
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/mzabriskie/axios/pull/91)) | ||
- Fixing issue with IE8 ([#85](https://github.com/mzabriskie/axios/pull/85)) | ||
- Converting build to UMD | ||
- Fixing build problem causing ridiculous file sizes | ||
### 0.7.0 (Sep 29, 2015) | ||
### 0.2.0 (Sep 12, 2014) | ||
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/mzabriskie/axios/pull/87)) | ||
- Adding support for passing agent in node ([#102](https://github.com/mzabriskie/axios/pull/102)) | ||
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/mzabriskie/axios/pull/106)) | ||
- Fixing typescript definition ([#105](https://github.com/mzabriskie/axios/pull/105)) | ||
- Fixing default timeout config for node ([#112](https://github.com/mzabriskie/axios/pull/112)) | ||
- Adding support for use in web workers, and react-native ([#70](https://github.com/mzabriskie/axios/issue/70)), ([#98](https://github.com/mzabriskie/axios/pull/98)) | ||
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/mzabriskie/axios/issues/116)) | ||
- Adding support for `all` and `spread` | ||
- Adding support for node.js ([#1](https://github.com/mzabriskie/axios/issues/1)) | ||
### 0.8.0 (Dec 11, 2015) | ||
### 0.1.0 (Aug 29, 2014) | ||
- Adding support for creating instances of axios ([#123](https://github.com/mzabriskie/axios/pull/123)) | ||
- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/mzabriskie/axios/pull/128)) | ||
- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/mzabriskie/axios/pull/121)) | ||
- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/mzabriskie/axios/pull/127)) | ||
- Adding support for following redirects in node ([#146](https://github.com/mzabriskie/axios/pull/146)) | ||
- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/mzabriskie/axios/pull/149)) | ||
- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/mzabriskie/axios/pull/140)) | ||
- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/mzabriskie/axios/pull/167)) | ||
- Adding support for baseURL option ([#160](https://github.com/mzabriskie/axios/pull/160)) | ||
- Initial release |
@@ -72,4 +72,5 @@ /* axios v0.8.0 | (c) 2015 by Matt Zabriskie */ | ||
var combineURLs = __webpack_require__(14); | ||
var bind = __webpack_require__(15); | ||
function Axios (defaultConfig) { | ||
function Axios(defaultConfig) { | ||
this.defaultConfig = utils.merge({ | ||
@@ -88,3 +89,4 @@ headers: {}, | ||
Axios.prototype.request = function (config) { | ||
Axios.prototype.request = function request(config) { | ||
/*eslint no-param-reassign:0*/ | ||
// Allow for axios('example/url'[, config]) a la fetch API | ||
@@ -110,7 +112,7 @@ if (typeof config === 'string') { | ||
this.interceptors.request.forEach(function (interceptor) { | ||
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { | ||
chain.unshift(interceptor.fulfilled, interceptor.rejected); | ||
}); | ||
this.interceptors.response.forEach(function (interceptor) { | ||
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { | ||
chain.push(interceptor.fulfilled, interceptor.rejected); | ||
@@ -130,3 +132,3 @@ }); | ||
axios.create = function (defaultConfig) { | ||
axios.create = function create(defaultConfig) { | ||
return new Axios(defaultConfig); | ||
@@ -139,6 +141,6 @@ }; | ||
// Expose all/spread | ||
axios.all = function (promises) { | ||
axios.all = function all(promises) { | ||
return Promise.all(promises); | ||
}; | ||
axios.spread = __webpack_require__(15); | ||
axios.spread = __webpack_require__(16); | ||
@@ -148,16 +150,6 @@ // Expose interceptors | ||
// Helpers | ||
function bind (fn, thisArg) { | ||
return function () { | ||
var args = new Array(arguments.length); | ||
for (var i = 0; i < args.length; i++) { | ||
args[i] = arguments[i]; | ||
} | ||
return fn.apply(thisArg, args); | ||
}; | ||
} | ||
// Provide aliases for supported request methods | ||
utils.forEach(['delete', 'get', 'head'], function (method) { | ||
Axios.prototype[method] = function (url, config) { | ||
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { | ||
/*eslint func-names:0*/ | ||
Axios.prototype[method] = function(url, config) { | ||
return this.request(utils.merge(config || {}, { | ||
@@ -171,4 +163,5 @@ method: method, | ||
utils.forEach(['post', 'put', 'patch'], function (method) { | ||
Axios.prototype[method] = function (url, data, config) { | ||
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { | ||
/*eslint func-names:0*/ | ||
Axios.prototype[method] = function(url, data, config) { | ||
return this.request(utils.merge(config || {}, { | ||
@@ -198,4 +191,4 @@ method: method, | ||
module.exports = { | ||
transformRequest: [function (data, headers) { | ||
if(utils.isFormData(data)) { | ||
transformRequest: [function transformResponseJSON(data, headers) { | ||
if (utils.isFormData(data)) { | ||
return data; | ||
@@ -212,3 +205,3 @@ } | ||
if (!utils.isUndefined(headers)) { | ||
utils.forEach(headers, function (val, key) { | ||
utils.forEach(headers, function processContentTypeHeader(val, key) { | ||
if (key.toLowerCase() === 'content-type') { | ||
@@ -228,3 +221,4 @@ headers['Content-Type'] = val; | ||
transformResponse: [function (data) { | ||
transformResponse: [function transformResponseJSON(data) { | ||
/*eslint no-param-reassign:0*/ | ||
if (typeof data === 'string') { | ||
@@ -304,7 +298,9 @@ data = data.replace(PROTECTION_PREFIX, ''); | ||
function isArrayBufferView(val) { | ||
var result; | ||
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { | ||
return ArrayBuffer.isView(val); | ||
result = ArrayBuffer.isView(val); | ||
} else { | ||
return (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); | ||
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); | ||
} | ||
return result; | ||
} | ||
@@ -433,13 +429,13 @@ | ||
if (typeof obj !== 'object' && !isArray(obj)) { | ||
/*eslint no-param-reassign:0*/ | ||
obj = [obj]; | ||
} | ||
// Iterate over array values | ||
if (isArray(obj)) { | ||
// Iterate over array values | ||
for (var i = 0, l = obj.length; i < l; i++) { | ||
fn.call(null, obj[i], i, obj); | ||
} | ||
} | ||
// Iterate over object keys | ||
else { | ||
} else { | ||
// Iterate over object keys | ||
for (var key in obj) { | ||
@@ -470,7 +466,9 @@ if (obj.hasOwnProperty(key)) { | ||
*/ | ||
function merge(/*obj1, obj2, obj3, ...*/) { | ||
function merge(/* obj1, obj2, obj3, ... */) { | ||
var result = {}; | ||
var assignValue = function (val, key) { result[key] = val; }; | ||
var length = arguments.length; | ||
for (var i = 0; i < length; i++) { | ||
function assignValue(val, key) { | ||
result[key] = val; | ||
} | ||
for (var i = 0, l = arguments.length; i < l; i++) { | ||
forEach(arguments[i], assignValue); | ||
@@ -514,10 +512,9 @@ } | ||
module.exports = function dispatchRequest(config) { | ||
return new Promise(function (resolve, reject) { | ||
return new Promise(function executor(resolve, reject) { | ||
try { | ||
// For browsers use XHR adapter | ||
if ((typeof XMLHttpRequest !== 'undefined') || (typeof ActiveXObject !== 'undefined')) { | ||
// For browsers use XHR adapter | ||
__webpack_require__(5)(resolve, reject, config); | ||
} | ||
// For node use HTTP adapter | ||
else if (typeof process !== 'undefined') { | ||
} else if (typeof process !== 'undefined') { | ||
// For node use HTTP adapter | ||
__webpack_require__(5)(resolve, reject, config); | ||
@@ -547,3 +544,3 @@ } | ||
var isURLSameOrigin = __webpack_require__(9); | ||
var btoa = window.btoa || __webpack_require__(10) | ||
var btoa = window.btoa || __webpack_require__(10); | ||
@@ -569,3 +566,3 @@ module.exports = function xhrAdapter(resolve, reject, config) { | ||
var adapter = (XMLHttpRequest || ActiveXObject); | ||
var Adapter = (XMLHttpRequest || ActiveXObject); | ||
var loadEvent = 'onreadystatechange'; | ||
@@ -575,4 +572,4 @@ var xDomain = false; | ||
// For IE 8/9 CORS support | ||
if(!isURLSameOrigin(config.url) && window.XDomainRequest){ | ||
adapter = window.XDomainRequest; | ||
if (!isURLSameOrigin(config.url) && window.XDomainRequest) { | ||
Adapter = window.XDomainRequest; | ||
loadEvent = 'onload'; | ||
@@ -586,7 +583,7 @@ xDomain = true; | ||
var password = config.auth.password || ''; | ||
requestHeaders['Authorization'] = 'Basic: ' + btoa(username + ':' + password); | ||
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); | ||
} | ||
// Create the request | ||
var request = new adapter('Microsoft.XMLHTTP'); | ||
var request = new Adapter('Microsoft.XMLHTTP'); | ||
request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); | ||
@@ -598,3 +595,3 @@ | ||
// Listen for ready state | ||
request[loadEvent] = function () { | ||
request[loadEvent] = function handleReadyState() { | ||
if (request && (request.readyState === 4 || xDomain)) { | ||
@@ -616,3 +613,3 @@ // Prepare the response | ||
// Resolve or reject the Promise based on the status | ||
((request.status >= 200 && request.status < 300) || (request.responseText && xDomain) ? | ||
((request.status >= 200 && request.status < 300) || (xDomain && request.responseText) ? | ||
resolve : | ||
@@ -633,3 +630,3 @@ reject)(response); | ||
// Add xsrf header | ||
var xsrfValue = isURLSameOrigin(config.url) ? | ||
var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ? | ||
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) : | ||
@@ -644,13 +641,13 @@ undefined; | ||
// Add headers to the request | ||
if(!xDomain) | ||
utils.forEach(requestHeaders, function (val, key) { | ||
// Remove Content-Type if data is undefined | ||
if (!xDomain) { | ||
utils.forEach(requestHeaders, function setRequestHeader(val, key) { | ||
if (!data && key.toLowerCase() === 'content-type') { | ||
// Remove Content-Type if data is undefined | ||
delete requestHeaders[key]; | ||
} | ||
// Otherwise add header to the request | ||
else { | ||
} else { | ||
// Otherwise add header to the request | ||
request.setRequestHeader(key, val); | ||
} | ||
}); | ||
} | ||
@@ -709,2 +706,3 @@ // Add withCredentials to request if needed | ||
module.exports = function buildURL(url, params, paramsSerializer) { | ||
/*eslint no-param-reassign:0*/ | ||
if (!params) { | ||
@@ -717,7 +715,6 @@ return url; | ||
serializedParams = paramsSerializer(params); | ||
} | ||
else { | ||
} else { | ||
var parts = []; | ||
utils.forEach(params, function (val, key) { | ||
utils.forEach(params, function serialize(val, key) { | ||
if (val === null || typeof val === 'undefined') { | ||
@@ -735,7 +732,6 @@ return; | ||
utils.forEach(val, function (v) { | ||
utils.forEach(val, function parseValue(v) { | ||
if (utils.isDate(v)) { | ||
v = v.toISOString(); | ||
} | ||
else if (utils.isObject(v)) { | ||
} else if (utils.isObject(v)) { | ||
v = JSON.stringify(v); | ||
@@ -781,7 +777,10 @@ } | ||
module.exports = function parseHeaders(headers) { | ||
var parsed = {}, key, val, i; | ||
var parsed = {}; | ||
var key; | ||
var val; | ||
var i; | ||
if (!headers) { return parsed; } | ||
utils.forEach(headers.split('\n'), function(line) { | ||
utils.forEach(headers.split('\n'), function parser(line) { | ||
i = line.indexOf(':'); | ||
@@ -817,3 +816,4 @@ key = utils.trim(line.substr(0, i)).toLowerCase(); | ||
module.exports = function transformData(data, headers, fns) { | ||
utils.forEach(fns, function (fn) { | ||
/*eslint no-param-reassign:0*/ | ||
utils.forEach(fns, function transform(fn) { | ||
data = fn(data, headers); | ||
@@ -839,3 +839,3 @@ }); | ||
// whether the request URL is of the same origin as current location. | ||
(function () { | ||
(function standardBrowserEnv() { | ||
var msie = /(msie|trident)/i.test(navigator.userAgent); | ||
@@ -893,3 +893,3 @@ var urlParsingNode = document.createElement('a'); | ||
// Non standard browser envs (web workers, react-native) lack needed support. | ||
(function () { | ||
(function nonStandardBrowserEnv() { | ||
return function isURLSameOrigin() { | ||
@@ -916,9 +916,11 @@ return true; | ||
InvalidCharacterError.prototype = new Error; | ||
InvalidCharacterError.prototype.code = 5; | ||
InvalidCharacterError.prototype.name = 'InvalidCharacterError'; | ||
function btoa (input) { | ||
function btoa(input) { | ||
var str = String(input); | ||
var output = ''; | ||
for ( | ||
// initialize result and counter | ||
var block, charCode, idx = 0, map = chars, output = ''; | ||
var block, charCode, idx = 0, map = chars; | ||
// if the next str index does not exist: | ||
@@ -931,5 +933,5 @@ // change the mapping table to "=" | ||
) { | ||
charCode = str.charCodeAt(idx += 3/4); | ||
charCode = str.charCodeAt(idx += 3 / 4); | ||
if (charCode > 0xFF) { | ||
throw new InvalidCharacterError('\'btoa\' failed: The string to be encoded contains characters outside of the Latin1 range.'); | ||
throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5'); | ||
} | ||
@@ -939,5 +941,5 @@ block = block << 8 | charCode; | ||
return output; | ||
}; | ||
} | ||
module.exports = btoa | ||
module.exports = btoa; | ||
@@ -957,3 +959,3 @@ | ||
// Standard browser envs support document.cookie | ||
(function () { | ||
(function standardBrowserEnv() { | ||
return { | ||
@@ -995,3 +997,3 @@ write: function write(name, value, expires, path, domain, secure) { | ||
// Non standard browser env (web workers, react-native) lack needed support. | ||
(function () { | ||
(function nonStandardBrowserEnv() { | ||
return { | ||
@@ -1026,3 +1028,3 @@ write: function write() {}, | ||
*/ | ||
InterceptorManager.prototype.use = function (fulfilled, rejected) { | ||
InterceptorManager.prototype.use = function use(fulfilled, rejected) { | ||
this.handlers.push({ | ||
@@ -1040,3 +1042,3 @@ fulfilled: fulfilled, | ||
*/ | ||
InterceptorManager.prototype.eject = function (id) { | ||
InterceptorManager.prototype.eject = function eject(id) { | ||
if (this.handlers[id]) { | ||
@@ -1051,8 +1053,8 @@ this.handlers[id] = null; | ||
* This method is particularly useful for skipping over any | ||
* interceptors that may have become `null` calling `remove`. | ||
* interceptors that may have become `null` calling `eject`. | ||
* | ||
* @param {Function} fn The function to call for each interceptor | ||
*/ | ||
InterceptorManager.prototype.forEach = function (fn) { | ||
utils.forEach(this.handlers, function (h) { | ||
InterceptorManager.prototype.forEach = function forEach(fn) { | ||
utils.forEach(this.handlers, function forEachHandler(h) { | ||
if (h !== null) { | ||
@@ -1111,2 +1113,19 @@ fn(h); | ||
module.exports = function bind(fn, thisArg) { | ||
return function wrap() { | ||
var args = new Array(arguments.length); | ||
for (var i = 0; i < args.length; i++) { | ||
args[i] = arguments[i]; | ||
} | ||
return fn.apply(thisArg, args); | ||
}; | ||
}; | ||
/***/ }, | ||
/* 16 */ | ||
/***/ function(module, exports) { | ||
'use strict'; | ||
/** | ||
@@ -1133,3 +1152,3 @@ * Syntactic sugar for invoking a function and expanding an array for arguments. | ||
module.exports = function spread(callback) { | ||
return function (arr) { | ||
return function wrap(arr) { | ||
return callback.apply(null, arr); | ||
@@ -1136,0 +1155,0 @@ }; |
/* axios v0.8.0 | (c) 2015 by Matt Zabriskie */ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";function n(e){this.defaultConfig=s.merge({headers:{},timeout:i.timeout,transformRequest:i.transformRequest,transformResponse:i.transformResponse},e),this.interceptors={request:new a,response:new a}}function o(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}var i=r(2),s=r(3),u=r(4),a=r(12),c=r(13),f=r(14);n.prototype.request=function(e){"string"==typeof e&&(e=s.merge({url:arguments[0]},arguments[1])),e=s.merge(this.defaultConfig,{method:"get"},e),e.baseURL&&!c(e.url)&&(e.url=f(e.baseURL,e.url)),e.withCredentials=e.withCredentials||i.withCredentials;var t=[u,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)r=r.then(t.shift(),t.shift());return r};var p=new n,l=e.exports=o(n.prototype.request,p);l.create=function(e){return new n(e)},l.defaults=i,l.all=function(e){return Promise.all(e)},l.spread=r(15),l.interceptors=p.interceptors,s.forEach(["delete","get","head"],function(e){n.prototype[e]=function(t,r){return this.request(s.merge(r||{},{method:e,url:t}))},l[e]=o(n.prototype[e],p)}),s.forEach(["post","put","patch"],function(e){n.prototype[e]=function(t,r,n){return this.request(s.merge(n||{},{method:e,url:t,data:r}))},l[e]=o(n.prototype[e],p)})},function(e,t,r){"use strict";var n=r(3),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};e.exports={transformRequest:[function(e,t){return n.isFormData(e)?e:n.isArrayBuffer(e)?e:n.isArrayBufferView(e)?e.buffer:!n.isObject(e)||n.isFile(e)||n.isBlob(e)?e:(n.isUndefined(t)||(n.forEach(t,function(e,r){"content-type"===r.toLowerCase()&&(t["Content-Type"]=e)}),n.isUndefined(t["Content-Type"])&&(t["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(e))}],transformResponse:[function(e){if("string"==typeof e){e=e.replace(o,"");try{e=JSON.parse(e)}catch(t){}}return e}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:n.merge(i),post:n.merge(i),put:n.merge(i)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(e,t){"use strict";function r(e){return"[object Array]"===g.call(e)}function n(e){return"[object ArrayBuffer]"===g.call(e)}function o(e){return"[object FormData]"===g.call(e)}function i(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function s(e){return"string"==typeof e}function u(e){return"number"==typeof e}function a(e){return"undefined"==typeof e}function c(e){return null!==e&&"object"==typeof e}function f(e){return"[object Date]"===g.call(e)}function p(e){return"[object File]"===g.call(e)}function l(e){return"[object Blob]"===g.call(e)}function d(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function h(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function m(e,t){if(null!==e&&"undefined"!=typeof e)if("object"==typeof e||r(e)||(e=[e]),r(e))for(var n=0,o=e.length;o>n;n++)t.call(null,e[n],n,e);else for(var i in e)e.hasOwnProperty(i)&&t.call(null,e[i],i,e)}function y(){for(var e={},t=function(t,r){e[r]=t},r=arguments.length,n=0;r>n;n++)m(arguments[n],t);return e}var g=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:n,isFormData:o,isArrayBufferView:i,isString:s,isNumber:u,isObject:c,isUndefined:a,isDate:f,isFile:p,isBlob:l,isStandardBrowserEnv:h,forEach:m,merge:y,trim:d}},function(e,t,r){"use strict";e.exports=function(e){return new Promise(function(t,n){try{"undefined"!=typeof XMLHttpRequest||"undefined"!=typeof ActiveXObject?r(5)(t,n,e):"undefined"!=typeof process&&r(5)(t,n,e)}catch(o){n(o)}})}},function(e,t,r){"use strict";var n=r(2),o=r(3),i=r(6),s=r(7),u=r(8),a=r(9),c=window.btoa||r(10);e.exports=function(e,t,f){var p=u(f.data,f.headers,f.transformRequest),l=o.merge(n.headers.common,n.headers[f.method]||{},f.headers||{});o.isFormData(p)&&delete l["Content-Type"];var d=XMLHttpRequest||ActiveXObject,h="onreadystatechange",m=!1;if(!a(f.url)&&window.XDomainRequest&&(d=window.XDomainRequest,h="onload",m=!0),f.auth){var y=f.auth.username||"",g=f.auth.password||"";l.Authorization="Basic: "+c(y+":"+g)}var w=new d("Microsoft.XMLHTTP");if(w.open(f.method.toUpperCase(),i(f.url,f.params,f.paramsSerializer),!0),w.timeout=f.timeout,w[h]=function(){if(w&&(4===w.readyState||m)){var r=m?null:s(w.getAllResponseHeaders()),n=-1!==["text",""].indexOf(f.responseType||"")?w.responseText:w.response,o={data:u(n,r,f.transformResponse),status:w.status,statusText:w.statusText,headers:r,config:f};(w.status>=200&&w.status<300||w.responseText&&m?e:t)(o),w=null}},o.isStandardBrowserEnv()){var v=r(11),x=a(f.url)?v.read(f.xsrfCookieName||n.xsrfCookieName):void 0;x&&(l[f.xsrfHeaderName||n.xsrfHeaderName]=x)}if(m||o.forEach(l,function(e,t){p||"content-type"!==t.toLowerCase()?w.setRequestHeader(t,e):delete l[t]}),f.withCredentials&&(w.withCredentials=!0),f.responseType)try{w.responseType=f.responseType}catch(b){if("json"!==w.responseType)throw b}o.isArrayBuffer(p)&&(p=new DataView(p)),w.send(p)}},function(e,t,r){"use strict";function n(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=r(3);e.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else{var s=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)&&(t+="[]"),o.isArray(e)||(e=[e]),o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(n(t)+"="+n(e))}))}),i=s.join("&")}return i&&(e+=(-1===e.indexOf("?")?"?":"&")+i),e}},function(e,t,r){"use strict";var n=r(3);e.exports=function(e){var t,r,o,i={};return e?(n.forEach(e.split("\n"),function(e){o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t&&(i[t]=i[t]?i[t]+", "+r:r)}),i):i}},function(e,t,r){"use strict";var n=r(3);e.exports=function(e,t,r){return n.forEach(r,function(r){e=r(e,t)}),e}},function(e,t,r){"use strict";var n=r(3);e.exports=n.isStandardBrowserEnv()?function(){function e(e){var t=e;return r&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,r=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(r){var o=n.isString(r)?e(r):r;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function r(e){this.message=e}function n(e){for(var t,n,i=String(e),s=0,u=o,a="";i.charAt(0|s)||(u="=",s%1);a+=u.charAt(63&t>>8-s%1*8)){if(n=i.charCodeAt(s+=.75),n>255)throw new r("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");t=t<<8|n}return a}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.name="InvalidCharacterError",e.exports=n},function(e,t,r){"use strict";var n=r(3);e.exports=n.isStandardBrowserEnv()?function(){return{write:function(e,t,r,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),n.isString(o)&&u.push("path="+o),n.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,r){"use strict";function n(){this.handlers=[]}var o=r(3);n.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=n},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"")}},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";function n(e){this.defaultConfig=i.merge({headers:{},timeout:o.timeout,transformRequest:o.transformRequest,transformResponse:o.transformResponse},e),this.interceptors={request:new u,response:new u}}var o=r(2),i=r(3),s=r(4),u=r(12),a=r(13),c=r(14),f=r(15);n.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(this.defaultConfig,{method:"get"},e),e.baseURL&&!a(e.url)&&(e.url=c(e.baseURL,e.url)),e.withCredentials=e.withCredentials||o.withCredentials;var t=[s,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)r=r.then(t.shift(),t.shift());return r};var p=new n,l=e.exports=f(n.prototype.request,p);l.create=function(e){return new n(e)},l.defaults=o,l.all=function(e){return Promise.all(e)},l.spread=r(16),l.interceptors=p.interceptors,i.forEach(["delete","get","head"],function(e){n.prototype[e]=function(t,r){return this.request(i.merge(r||{},{method:e,url:t}))},l[e]=f(n.prototype[e],p)}),i.forEach(["post","put","patch"],function(e){n.prototype[e]=function(t,r,n){return this.request(i.merge(n||{},{method:e,url:t,data:r}))},l[e]=f(n.prototype[e],p)})},function(e,t,r){"use strict";var n=r(3),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};e.exports={transformRequest:[function(e,t){return n.isFormData(e)?e:n.isArrayBuffer(e)?e:n.isArrayBufferView(e)?e.buffer:!n.isObject(e)||n.isFile(e)||n.isBlob(e)?e:(n.isUndefined(t)||(n.forEach(t,function(e,r){"content-type"===r.toLowerCase()&&(t["Content-Type"]=e)}),n.isUndefined(t["Content-Type"])&&(t["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(e))}],transformResponse:[function(e){if("string"==typeof e){e=e.replace(o,"");try{e=JSON.parse(e)}catch(t){}}return e}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:n.merge(i),post:n.merge(i),put:n.merge(i)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(e,t){"use strict";function r(e){return"[object Array]"===g.call(e)}function n(e){return"[object ArrayBuffer]"===g.call(e)}function o(e){return"[object FormData]"===g.call(e)}function i(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function s(e){return"string"==typeof e}function u(e){return"number"==typeof e}function a(e){return"undefined"==typeof e}function c(e){return null!==e&&"object"==typeof e}function f(e){return"[object Date]"===g.call(e)}function p(e){return"[object File]"===g.call(e)}function l(e){return"[object Blob]"===g.call(e)}function d(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function h(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function m(e,t){if(null!==e&&"undefined"!=typeof e)if("object"==typeof e||r(e)||(e=[e]),r(e))for(var n=0,o=e.length;o>n;n++)t.call(null,e[n],n,e);else for(var i in e)e.hasOwnProperty(i)&&t.call(null,e[i],i,e)}function y(){function e(e,r){t[r]=e}for(var t={},r=0,n=arguments.length;n>r;r++)m(arguments[r],e);return t}var g=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:n,isFormData:o,isArrayBufferView:i,isString:s,isNumber:u,isObject:c,isUndefined:a,isDate:f,isFile:p,isBlob:l,isStandardBrowserEnv:h,forEach:m,merge:y,trim:d}},function(e,t,r){"use strict";e.exports=function(e){return new Promise(function(t,n){try{"undefined"!=typeof XMLHttpRequest||"undefined"!=typeof ActiveXObject?r(5)(t,n,e):"undefined"!=typeof process&&r(5)(t,n,e)}catch(o){n(o)}})}},function(e,t,r){"use strict";var n=r(2),o=r(3),i=r(6),s=r(7),u=r(8),a=r(9),c=window.btoa||r(10);e.exports=function(e,t,f){var p=u(f.data,f.headers,f.transformRequest),l=o.merge(n.headers.common,n.headers[f.method]||{},f.headers||{});o.isFormData(p)&&delete l["Content-Type"];var d=XMLHttpRequest||ActiveXObject,h="onreadystatechange",m=!1;if(!a(f.url)&&window.XDomainRequest&&(d=window.XDomainRequest,h="onload",m=!0),f.auth){var y=f.auth.username||"",g=f.auth.password||"";l.Authorization="Basic "+c(y+":"+g)}var w=new d("Microsoft.XMLHTTP");if(w.open(f.method.toUpperCase(),i(f.url,f.params,f.paramsSerializer),!0),w.timeout=f.timeout,w[h]=function(){if(w&&(4===w.readyState||m)){var r=m?null:s(w.getAllResponseHeaders()),n=-1!==["text",""].indexOf(f.responseType||"")?w.responseText:w.response,o={data:u(n,r,f.transformResponse),status:w.status,statusText:w.statusText,headers:r,config:f};(w.status>=200&&w.status<300||m&&w.responseText?e:t)(o),w=null}},o.isStandardBrowserEnv()){var v=r(11),x=f.withCredentials||a(f.url)?v.read(f.xsrfCookieName||n.xsrfCookieName):void 0;x&&(l[f.xsrfHeaderName||n.xsrfHeaderName]=x)}if(m||o.forEach(l,function(e,t){p||"content-type"!==t.toLowerCase()?w.setRequestHeader(t,e):delete l[t]}),f.withCredentials&&(w.withCredentials=!0),f.responseType)try{w.responseType=f.responseType}catch(b){if("json"!==w.responseType)throw b}o.isArrayBuffer(p)&&(p=new DataView(p)),w.send(p)}},function(e,t,r){"use strict";function n(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=r(3);e.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else{var s=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)&&(t+="[]"),o.isArray(e)||(e=[e]),o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(n(t)+"="+n(e))}))}),i=s.join("&")}return i&&(e+=(-1===e.indexOf("?")?"?":"&")+i),e}},function(e,t,r){"use strict";var n=r(3);e.exports=function(e){var t,r,o,i={};return e?(n.forEach(e.split("\n"),function(e){o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t&&(i[t]=i[t]?i[t]+", "+r:r)}),i):i}},function(e,t,r){"use strict";var n=r(3);e.exports=function(e,t,r){return n.forEach(r,function(r){e=r(e,t)}),e}},function(e,t,r){"use strict";var n=r(3);e.exports=n.isStandardBrowserEnv()?function(){function e(e){var t=e;return r&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,r=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(r){var o=n.isString(r)?e(r):r;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function r(e){this.message=e}function n(e){for(var t,n,i=String(e),s="",u=0,a=o;i.charAt(0|u)||(a="=",u%1);s+=a.charAt(63&t>>8-u%1*8)){if(n=i.charCodeAt(u+=.75),n>255)throw new r("INVALID_CHARACTER_ERR: DOM Exception 5");t=t<<8|n}return s}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",e.exports=n},function(e,t,r){"use strict";var n=r(3);e.exports=n.isStandardBrowserEnv()?function(){return{write:function(e,t,r,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),n.isString(o)&&u.push("path="+o),n.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,r){"use strict";function n(){this.handlers=[]}var o=r(3);n.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=n},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"")}},function(e,t){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])}); | ||
//# sourceMappingURL=axios.min.map |
@@ -71,31 +71,31 @@ 'use strict'; | ||
var transport = parsed.protocol === 'https:' ? https : http; | ||
var req = transport.request(options, function (res) { | ||
var req = transport.request(options, function handleResponse(res) { | ||
// uncompress the response body transparently if required | ||
var stream = res; | ||
switch(res.headers['content-encoding']) { | ||
case 'gzip': | ||
case 'compress': | ||
case 'deflate': { | ||
// add the unzipper to the body stream processing pipeline | ||
stream = stream.pipe(zlib.createUnzip()); | ||
switch (res.headers['content-encoding']) { | ||
/*eslint default-case:0*/ | ||
case 'gzip': | ||
case 'compress': | ||
case 'deflate': | ||
// add the unzipper to the body stream processing pipeline | ||
stream = stream.pipe(zlib.createUnzip()); | ||
// remove the content-encoding in order to not confuse downstream operations | ||
delete res.headers['content-encoding']; | ||
} | ||
// remove the content-encoding in order to not confuse downstream operations | ||
delete res.headers['content-encoding']; | ||
break; | ||
} | ||
var responseBuffer = []; | ||
stream.on('data', function (chunk) { | ||
stream.on('data', function handleStreamData(chunk) { | ||
responseBuffer.push(chunk); | ||
}); | ||
stream.on('end', function () { | ||
var data = Buffer.concat(responseBuffer); | ||
stream.on('end', function handleStreamEnd() { | ||
var d = Buffer.concat(responseBuffer); | ||
if (config.responseType !== 'arraybuffer') { | ||
data = data.toString('utf8'); | ||
d = d.toString('utf8'); | ||
} | ||
var response = { | ||
data: transformData( | ||
data, | ||
d, | ||
res.headers, | ||
@@ -118,3 +118,3 @@ config.transformResponse | ||
// Handle errors | ||
req.on('error', function (err) { | ||
req.on('error', function handleRequestError(err) { | ||
reject(err); | ||
@@ -124,3 +124,3 @@ }); | ||
// Handle request timeout | ||
req.setTimeout(config.timeout, function () { | ||
req.setTimeout(config.timeout, function handleRequestTimeout() { | ||
req.abort(); | ||
@@ -127,0 +127,0 @@ }); |
@@ -11,3 +11,3 @@ 'use strict'; | ||
var isURLSameOrigin = require('./../helpers/isURLSameOrigin'); | ||
var btoa = window.btoa || require('./../helpers/btoa.js') | ||
var btoa = window.btoa || require('./../helpers/btoa'); | ||
@@ -33,3 +33,3 @@ module.exports = function xhrAdapter(resolve, reject, config) { | ||
var adapter = (XMLHttpRequest || ActiveXObject); | ||
var Adapter = (XMLHttpRequest || ActiveXObject); | ||
var loadEvent = 'onreadystatechange'; | ||
@@ -39,4 +39,4 @@ var xDomain = false; | ||
// For IE 8/9 CORS support | ||
if(!isURLSameOrigin(config.url) && window.XDomainRequest){ | ||
adapter = window.XDomainRequest; | ||
if (!isURLSameOrigin(config.url) && window.XDomainRequest) { | ||
Adapter = window.XDomainRequest; | ||
loadEvent = 'onload'; | ||
@@ -50,7 +50,7 @@ xDomain = true; | ||
var password = config.auth.password || ''; | ||
requestHeaders['Authorization'] = 'Basic: ' + btoa(username + ':' + password); | ||
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); | ||
} | ||
// Create the request | ||
var request = new adapter('Microsoft.XMLHTTP'); | ||
var request = new Adapter('Microsoft.XMLHTTP'); | ||
request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); | ||
@@ -62,3 +62,3 @@ | ||
// Listen for ready state | ||
request[loadEvent] = function () { | ||
request[loadEvent] = function handleReadyState() { | ||
if (request && (request.readyState === 4 || xDomain)) { | ||
@@ -80,3 +80,3 @@ // Prepare the response | ||
// Resolve or reject the Promise based on the status | ||
((request.status >= 200 && request.status < 300) || (request.responseText && xDomain) ? | ||
((request.status >= 200 && request.status < 300) || (xDomain && request.responseText) ? | ||
resolve : | ||
@@ -97,3 +97,3 @@ reject)(response); | ||
// Add xsrf header | ||
var xsrfValue = isURLSameOrigin(config.url) ? | ||
var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ? | ||
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) : | ||
@@ -108,13 +108,13 @@ undefined; | ||
// Add headers to the request | ||
if(!xDomain) | ||
utils.forEach(requestHeaders, function (val, key) { | ||
// Remove Content-Type if data is undefined | ||
if (!xDomain) { | ||
utils.forEach(requestHeaders, function setRequestHeader(val, key) { | ||
if (!data && key.toLowerCase() === 'content-type') { | ||
// Remove Content-Type if data is undefined | ||
delete requestHeaders[key]; | ||
} | ||
// Otherwise add header to the request | ||
else { | ||
} else { | ||
// Otherwise add header to the request | ||
request.setRequestHeader(key, val); | ||
} | ||
}); | ||
} | ||
@@ -121,0 +121,0 @@ // Add withCredentials to request if needed |
@@ -9,4 +9,5 @@ 'use strict'; | ||
var combineURLs = require('./helpers/combineURLs'); | ||
var bind = require('./helpers/bind'); | ||
function Axios (defaultConfig) { | ||
function Axios(defaultConfig) { | ||
this.defaultConfig = utils.merge({ | ||
@@ -25,3 +26,4 @@ headers: {}, | ||
Axios.prototype.request = function (config) { | ||
Axios.prototype.request = function request(config) { | ||
/*eslint no-param-reassign:0*/ | ||
// Allow for axios('example/url'[, config]) a la fetch API | ||
@@ -47,7 +49,7 @@ if (typeof config === 'string') { | ||
this.interceptors.request.forEach(function (interceptor) { | ||
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { | ||
chain.unshift(interceptor.fulfilled, interceptor.rejected); | ||
}); | ||
this.interceptors.response.forEach(function (interceptor) { | ||
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { | ||
chain.push(interceptor.fulfilled, interceptor.rejected); | ||
@@ -67,3 +69,3 @@ }); | ||
axios.create = function (defaultConfig) { | ||
axios.create = function create(defaultConfig) { | ||
return new Axios(defaultConfig); | ||
@@ -76,3 +78,3 @@ }; | ||
// Expose all/spread | ||
axios.all = function (promises) { | ||
axios.all = function all(promises) { | ||
return Promise.all(promises); | ||
@@ -85,16 +87,6 @@ }; | ||
// Helpers | ||
function bind (fn, thisArg) { | ||
return function () { | ||
var args = new Array(arguments.length); | ||
for (var i = 0; i < args.length; i++) { | ||
args[i] = arguments[i]; | ||
} | ||
return fn.apply(thisArg, args); | ||
}; | ||
} | ||
// Provide aliases for supported request methods | ||
utils.forEach(['delete', 'get', 'head'], function (method) { | ||
Axios.prototype[method] = function (url, config) { | ||
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { | ||
/*eslint func-names:0*/ | ||
Axios.prototype[method] = function(url, config) { | ||
return this.request(utils.merge(config || {}, { | ||
@@ -108,4 +100,5 @@ method: method, | ||
utils.forEach(['post', 'put', 'patch'], function (method) { | ||
Axios.prototype[method] = function (url, data, config) { | ||
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { | ||
/*eslint func-names:0*/ | ||
Axios.prototype[method] = function(url, data, config) { | ||
return this.request(utils.merge(config || {}, { | ||
@@ -112,0 +105,0 @@ method: method, |
@@ -11,10 +11,9 @@ 'use strict'; | ||
module.exports = function dispatchRequest(config) { | ||
return new Promise(function (resolve, reject) { | ||
return new Promise(function executor(resolve, reject) { | ||
try { | ||
// For browsers use XHR adapter | ||
if ((typeof XMLHttpRequest !== 'undefined') || (typeof ActiveXObject !== 'undefined')) { | ||
// For browsers use XHR adapter | ||
require('../adapters/xhr')(resolve, reject, config); | ||
} | ||
// For node use HTTP adapter | ||
else if (typeof process !== 'undefined') { | ||
} else if (typeof process !== 'undefined') { | ||
// For node use HTTP adapter | ||
require('../adapters/http')(resolve, reject, config); | ||
@@ -21,0 +20,0 @@ } |
@@ -17,3 +17,3 @@ 'use strict'; | ||
*/ | ||
InterceptorManager.prototype.use = function (fulfilled, rejected) { | ||
InterceptorManager.prototype.use = function use(fulfilled, rejected) { | ||
this.handlers.push({ | ||
@@ -31,3 +31,3 @@ fulfilled: fulfilled, | ||
*/ | ||
InterceptorManager.prototype.eject = function (id) { | ||
InterceptorManager.prototype.eject = function eject(id) { | ||
if (this.handlers[id]) { | ||
@@ -42,8 +42,8 @@ this.handlers[id] = null; | ||
* This method is particularly useful for skipping over any | ||
* interceptors that may have become `null` calling `remove`. | ||
* interceptors that may have become `null` calling `eject`. | ||
* | ||
* @param {Function} fn The function to call for each interceptor | ||
*/ | ||
InterceptorManager.prototype.forEach = function (fn) { | ||
utils.forEach(this.handlers, function (h) { | ||
InterceptorManager.prototype.forEach = function forEach(fn) { | ||
utils.forEach(this.handlers, function forEachHandler(h) { | ||
if (h !== null) { | ||
@@ -50,0 +50,0 @@ fn(h); |
@@ -11,4 +11,4 @@ 'use strict'; | ||
module.exports = { | ||
transformRequest: [function (data, headers) { | ||
if(utils.isFormData(data)) { | ||
transformRequest: [function transformResponseJSON(data, headers) { | ||
if (utils.isFormData(data)) { | ||
return data; | ||
@@ -25,3 +25,3 @@ } | ||
if (!utils.isUndefined(headers)) { | ||
utils.forEach(headers, function (val, key) { | ||
utils.forEach(headers, function processContentTypeHeader(val, key) { | ||
if (key.toLowerCase() === 'content-type') { | ||
@@ -41,3 +41,4 @@ headers['Content-Type'] = val; | ||
transformResponse: [function (data) { | ||
transformResponse: [function transformResponseJSON(data) { | ||
/*eslint no-param-reassign:0*/ | ||
if (typeof data === 'string') { | ||
@@ -44,0 +45,0 @@ data = data.replace(PROTECTION_PREFIX, ''); |
@@ -11,9 +11,11 @@ 'use strict'; | ||
InvalidCharacterError.prototype = new Error; | ||
InvalidCharacterError.prototype.code = 5; | ||
InvalidCharacterError.prototype.name = 'InvalidCharacterError'; | ||
function btoa (input) { | ||
function btoa(input) { | ||
var str = String(input); | ||
var output = ''; | ||
for ( | ||
// initialize result and counter | ||
var block, charCode, idx = 0, map = chars, output = ''; | ||
var block, charCode, idx = 0, map = chars; | ||
// if the next str index does not exist: | ||
@@ -26,5 +28,5 @@ // change the mapping table to "=" | ||
) { | ||
charCode = str.charCodeAt(idx += 3/4); | ||
charCode = str.charCodeAt(idx += 3 / 4); | ||
if (charCode > 0xFF) { | ||
throw new InvalidCharacterError('\'btoa\' failed: The string to be encoded contains characters outside of the Latin1 range.'); | ||
throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5'); | ||
} | ||
@@ -34,4 +36,4 @@ block = block << 8 | charCode; | ||
return output; | ||
}; | ||
} | ||
module.exports = btoa | ||
module.exports = btoa; |
@@ -24,2 +24,3 @@ 'use strict'; | ||
module.exports = function buildURL(url, params, paramsSerializer) { | ||
/*eslint no-param-reassign:0*/ | ||
if (!params) { | ||
@@ -32,7 +33,6 @@ return url; | ||
serializedParams = paramsSerializer(params); | ||
} | ||
else { | ||
} else { | ||
var parts = []; | ||
utils.forEach(params, function (val, key) { | ||
utils.forEach(params, function serialize(val, key) { | ||
if (val === null || typeof val === 'undefined') { | ||
@@ -50,7 +50,6 @@ return; | ||
utils.forEach(val, function (v) { | ||
utils.forEach(val, function parseValue(v) { | ||
if (utils.isDate(v)) { | ||
v = v.toISOString(); | ||
} | ||
else if (utils.isObject(v)) { | ||
} else if (utils.isObject(v)) { | ||
v = JSON.stringify(v); | ||
@@ -57,0 +56,0 @@ } |
@@ -9,3 +9,3 @@ 'use strict'; | ||
// Standard browser envs support document.cookie | ||
(function () { | ||
(function standardBrowserEnv() { | ||
return { | ||
@@ -47,3 +47,3 @@ write: function write(name, value, expires, path, domain, secure) { | ||
// Non standard browser env (web workers, react-native) lack needed support. | ||
(function () { | ||
(function nonStandardBrowserEnv() { | ||
return { | ||
@@ -50,0 +50,0 @@ write: function write() {}, |
'use strict'; | ||
/*eslint no-console:0*/ | ||
/** | ||
@@ -4,0 +6,0 @@ * Supply a warning to the developer that a method they are using |
@@ -10,3 +10,3 @@ 'use strict'; | ||
// whether the request URL is of the same origin as current location. | ||
(function () { | ||
(function standardBrowserEnv() { | ||
var msie = /(msie|trident)/i.test(navigator.userAgent); | ||
@@ -64,3 +64,3 @@ var urlParsingNode = document.createElement('a'); | ||
// Non standard browser envs (web workers, react-native) lack needed support. | ||
(function () { | ||
(function nonStandardBrowserEnv() { | ||
return function isURLSameOrigin() { | ||
@@ -67,0 +67,0 @@ return true; |
@@ -19,7 +19,10 @@ 'use strict'; | ||
module.exports = function parseHeaders(headers) { | ||
var parsed = {}, key, val, i; | ||
var parsed = {}; | ||
var key; | ||
var val; | ||
var i; | ||
if (!headers) { return parsed; } | ||
utils.forEach(headers.split('\n'), function(line) { | ||
utils.forEach(headers.split('\n'), function parser(line) { | ||
i = line.indexOf(':'); | ||
@@ -26,0 +29,0 @@ key = utils.trim(line.substr(0, i)).toLowerCase(); |
@@ -24,5 +24,5 @@ 'use strict'; | ||
module.exports = function spread(callback) { | ||
return function (arr) { | ||
return function wrap(arr) { | ||
return callback.apply(null, arr); | ||
}; | ||
}; |
@@ -14,3 +14,4 @@ 'use strict'; | ||
module.exports = function transformData(data, headers, fns) { | ||
utils.forEach(fns, function (fn) { | ||
/*eslint no-param-reassign:0*/ | ||
utils.forEach(fns, function transform(fn) { | ||
data = fn(data, headers); | ||
@@ -17,0 +18,0 @@ }); |
@@ -46,7 +46,9 @@ 'use strict'; | ||
function isArrayBufferView(val) { | ||
var result; | ||
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { | ||
return ArrayBuffer.isView(val); | ||
result = ArrayBuffer.isView(val); | ||
} else { | ||
return (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); | ||
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); | ||
} | ||
return result; | ||
} | ||
@@ -175,13 +177,13 @@ | ||
if (typeof obj !== 'object' && !isArray(obj)) { | ||
/*eslint no-param-reassign:0*/ | ||
obj = [obj]; | ||
} | ||
// Iterate over array values | ||
if (isArray(obj)) { | ||
// Iterate over array values | ||
for (var i = 0, l = obj.length; i < l; i++) { | ||
fn.call(null, obj[i], i, obj); | ||
} | ||
} | ||
// Iterate over object keys | ||
else { | ||
} else { | ||
// Iterate over object keys | ||
for (var key in obj) { | ||
@@ -212,7 +214,9 @@ if (obj.hasOwnProperty(key)) { | ||
*/ | ||
function merge(/*obj1, obj2, obj3, ...*/) { | ||
function merge(/* obj1, obj2, obj3, ... */) { | ||
var result = {}; | ||
var assignValue = function (val, key) { result[key] = val; }; | ||
var length = arguments.length; | ||
for (var i = 0; i < length; i++) { | ||
function assignValue(val, key) { | ||
result[key] = val; | ||
} | ||
for (var i = 0, l = arguments.length; i < l; i++) { | ||
forEach(arguments[i], assignValue); | ||
@@ -219,0 +223,0 @@ } |
{ | ||
"name": "axios", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "Promise based HTTP client for the browser and node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
203944
30
2002