Comparing version 0.5.2 to 0.5.3
@@ -62,2 +62,6 @@ # Changelog | ||
- Adding support for `statusText` in response ([#46](https://github.com/mzabriskie/axios/issues/46)) | ||
- Adding support for `statusText` in response ([#46](https://github.com/mzabriskie/axios/issues/46)) | ||
### 0.5.3 (Apr 07, 2015) | ||
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/mzabriskie/axios/issues/55)) |
@@ -53,2 +53,4 @@ define("axios", [], function() { return /******/ (function(modules) { // webpackBootstrap | ||
'use strict'; | ||
var defaults = __webpack_require__(2); | ||
@@ -136,28 +138,29 @@ var utils = __webpack_require__(3); | ||
// Provide aliases for supported request methods | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
(function () { | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
})(); | ||
@@ -173,4 +176,2 @@ | ||
var JSON_START = /^\s*(\[|\{[^\{])/; | ||
var JSON_END = /[\}\]]\s*$/; | ||
var PROTECTION_PREFIX = /^\)\]\}',?\n/; | ||
@@ -202,5 +203,5 @@ var DEFAULT_CONTENT_TYPE = { | ||
data = data.replace(PROTECTION_PREFIX, ''); | ||
if (JSON_START.test(data) && JSON_END.test(data)) { | ||
try { | ||
data = JSON.parse(data); | ||
} | ||
} catch (e) {} | ||
} | ||
@@ -223,2 +224,3 @@ return data; | ||
/***/ }, | ||
@@ -228,2 +230,6 @@ /* 3 */ | ||
'use strict'; | ||
/*global toString:true*/ | ||
// utils is a library of generic helper functions non-specific to axios | ||
@@ -385,3 +391,3 @@ | ||
if (isArrayLike) { | ||
for (var i=0, l=obj.length; i<l; i++) { | ||
for (var i = 0, l = obj.length; i < l; i++) { | ||
fn.call(null, obj[i], i, obj); | ||
@@ -417,3 +423,3 @@ } | ||
*/ | ||
function merge(obj1/*, obj2, obj3, ...*/) { | ||
function merge(/*obj1, obj2, obj3, ...*/) { | ||
var result = {}; | ||
@@ -517,3 +523,3 @@ forEach(arguments, function (obj) { | ||
this.handlers = []; | ||
}; | ||
} | ||
@@ -559,3 +565,3 @@ /** | ||
fn(h); | ||
} | ||
} | ||
}); | ||
@@ -565,3 +571,2 @@ }; | ||
module.exports = InterceptorManager; | ||
@@ -573,2 +578,4 @@ | ||
'use strict'; | ||
/** | ||
@@ -600,2 +607,3 @@ * Syntactic sugar for invoking a function and expanding an array for arguments. | ||
/***/ }, | ||
@@ -605,2 +613,6 @@ /* 8 */ | ||
'use strict'; | ||
/*global ActiveXObject:true*/ | ||
var defaults = __webpack_require__(2); | ||
@@ -623,3 +635,3 @@ var utils = __webpack_require__(3); | ||
// Merge headers | ||
var headers = utils.merge( | ||
var requestHeaders = utils.merge( | ||
defaults.headers.common, | ||
@@ -631,7 +643,7 @@ defaults.headers[config.method] || {}, | ||
if (utils.isFormData(data)) { | ||
delete headers['Content-Type']; // Let the browser set it | ||
delete requestHeaders['Content-Type']; // Let the browser set it | ||
} | ||
// Create the request | ||
var request = new(XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
var request = new (XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
request.open(config.method.toUpperCase(), buildUrl(config.url, config.params), true); | ||
@@ -643,3 +655,3 @@ | ||
// Prepare the response | ||
var headers = parseHeaders(request.getAllResponseHeaders()); | ||
var responseHeaders = parseHeaders(request.getAllResponseHeaders()); | ||
var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response; | ||
@@ -649,3 +661,3 @@ var response = { | ||
responseData, | ||
headers, | ||
responseHeaders, | ||
config.transformResponse | ||
@@ -655,3 +667,3 @@ ), | ||
statusText: request.statusText, | ||
headers: headers, | ||
headers: responseHeaders, | ||
config: config | ||
@@ -661,5 +673,5 @@ }; | ||
// Resolve or reject the Promise based on the status | ||
(request.status >= 200 && request.status < 300 | ||
? resolve | ||
: reject)(response); | ||
(request.status >= 200 && request.status < 300 ? | ||
resolve : | ||
reject)(response); | ||
@@ -672,14 +684,14 @@ // Clean up request | ||
// Add xsrf header | ||
var xsrfValue = urlIsSameOrigin(config.url) | ||
? cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) | ||
: undefined; | ||
var xsrfValue = urlIsSameOrigin(config.url) ? | ||
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) : | ||
undefined; | ||
if (xsrfValue) { | ||
headers[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
requestHeaders[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
} | ||
// Add headers to the request | ||
utils.forEach(headers, function (val, key) { | ||
utils.forEach(requestHeaders, function (val, key) { | ||
// Remove Content-Type if data is undefined | ||
if (!data && key.toLowerCase() === 'content-type') { | ||
delete headers[key]; | ||
delete requestHeaders[key]; | ||
} | ||
@@ -1847,2 +1859,3 @@ // Otherwise add header to the request | ||
/***/ }, | ||
@@ -1872,3 +1885,3 @@ /* 13 */ | ||
if (!headers) return parsed; | ||
if (!headers) { return parsed; } | ||
@@ -1888,2 +1901,3 @@ utils.forEach(headers.split('\n'), function(line) { | ||
/***/ }, | ||
@@ -1913,2 +1927,3 @@ /* 14 */ | ||
/***/ }, | ||
@@ -1920,6 +1935,6 @@ /* 15 */ | ||
var utils = __webpack_require__(3); | ||
var msie = /(msie|trident)/i.test(navigator.userAgent); | ||
var utils = __webpack_require__(3); | ||
var urlParsingNode = document.createElement('a'); | ||
var originUrl = urlResolve(window.location.href); | ||
var originUrl; | ||
@@ -1952,8 +1967,10 @@ /** | ||
port: urlParsingNode.port, | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') | ||
? urlParsingNode.pathname | ||
: '/' + urlParsingNode.pathname | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') ? | ||
urlParsingNode.pathname : | ||
'/' + urlParsingNode.pathname | ||
}; | ||
} | ||
originUrl = urlResolve(window.location.href); | ||
/** | ||
@@ -1971,2 +1988,3 @@ * Determine if a URL shares the same origin as the current location | ||
/***/ }, | ||
@@ -1973,0 +1991,0 @@ /* 16 */ |
@@ -1,3 +0,3 @@ | ||
/* axios v0.5.2 | (c) 2015 by Matt Zabriskie */ | ||
define("axios",[],function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){function r(){s.forEach(arguments,function(t){f[t]=function(e,n){return f(s.merge(n||{},{method:t,url:e}))}})}function o(){s.forEach(arguments,function(t){f[t]=function(e,n,r){return f(s.merge(r||{},{method:t,url:e,data:n}))}})}var i=n(2),s=n(3),u=n(4),a=n(5),c=n(6);!function(){var t=n(9);t&&"function"==typeof t.polyfill&&t.polyfill()}();var f=t.exports=function l(t){t=s.merge({method:"get",headers:{},transformRequest:i.transformRequest,transformResponse:i.transformResponse},t),t.withCredentials=t.withCredentials||i.withCredentials;var e=[a,void 0],n=Promise.resolve(t);for(l.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),l.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n.success=function(t){return u("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(function(e){t(e.data,e.status,e.headers,e.config)}),n},n.error=function(t){return u("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(null,function(e){t(e.data,e.status,e.headers,e.config)}),n},n};f.defaults=i,f.all=function(t){return Promise.all(t)},f.spread=n(7),f.interceptors={request:new c,response:new c},r("delete","get","head"),o("post","put","patch")},function(t,e,n){"use strict";var r=n(3),o=/^\s*(\[|\{[^\{])/,i=/[\}\]]\s*$/,s=/^\)\]\}',?\n/,u={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,e){return r.isArrayBuffer(t)?t:r.isArrayBufferView(t)?t.buffer:!r.isObject(t)||r.isFile(t)||r.isBlob(t)?t:(!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]="application/json;charset=utf-8"),JSON.stringify(t))}],transformResponse:[function(t){return"string"==typeof t&&(t=t.replace(s,""),o.test(t)&&i.test(t)&&(t=JSON.parse(t))),t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(u),post:r.merge(u),put:r.merge(u)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t){function e(t){return"[object Array]"===m.call(t)}function n(t){return"[object ArrayBuffer]"===m.call(t)}function r(t){return"[object FormData]"===m.call(t)}function o(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function i(t){return"string"==typeof t}function s(t){return"number"==typeof t}function u(t){return"undefined"==typeof t}function a(t){return null!==t&&"object"==typeof t}function c(t){return"[object Date]"===m.call(t)}function f(t){return"[object File]"===m.call(t)}function l(t){return"[object Blob]"===m.call(t)}function p(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function h(t,n){if(null!==t&&"undefined"!=typeof t){var r=e(t)||"object"==typeof t&&!isNaN(t.length);if("object"==typeof t||r||(t=[t]),r)for(var o=0,i=t.length;i>o;o++)n.call(null,t[o],o,t);else for(var s in t)t.hasOwnProperty(s)&&n.call(null,t[s],s,t)}}function d(){var t={};return h(arguments,function(e){h(e,function(e,n){t[n]=e})}),t}var m=Object.prototype.toString;t.exports={isArray:e,isArrayBuffer:n,isFormData:r,isArrayBufferView:o,isString:i,isNumber:s,isObject:a,isUndefined:u,isDate:c,isFile:f,isBlob:l,forEach:h,merge:d,trim:p}},function(t){"use strict";t.exports=function(t,e,n){try{console.warn("DEPRECATED method `"+t+"`."+(e?" Use `"+e+"` instead.":"")+" This method will be removed in a future release."),n&&console.warn("For more information about usage see "+n)}catch(r){}}},function(t,e,n){(function(e){"use strict";t.exports=function(t){return new Promise(function(r,o){try{"undefined"!=typeof window?n(8)(r,o,t):"undefined"!=typeof e&&n(8)(r,o,t)}catch(i){o(i)}})}}).call(e,n(10))},function(t,e,n){"use strict";function r(){this.handlers=[]}var o=n(3);r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=r},function(t){t.exports=function(t){return function(e){t.apply(null,e)}}},function(t,e,n){var r=n(2),o=n(3),i=n(11),s=n(12),u=n(13),a=n(14),c=n(15);t.exports=function(t,e,n){var f=a(n.data,n.headers,n.transformRequest),l=o.merge(r.headers.common,r.headers[n.method]||{},n.headers||{});o.isFormData(f)&&delete l["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method.toUpperCase(),i(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=u(p.getAllResponseHeaders()),o=-1!==["text",""].indexOf(n.responseType||"")?p.responseText:p.response,i={data:a(o,r,n.transformResponse),status:p.status,statusText:p.statusText,headers:r,config:n};(p.status>=200&&p.status<300?t:e)(i),p=null}};var h=c(n.url)?s.read(n.xsrfCookieName||r.xsrfCookieName):void 0;if(h&&(l[n.xsrfHeaderName||r.xsrfHeaderName]=h),o.forEach(l,function(t,e){f||"content-type"!==e.toLowerCase()?p.setRequestHeader(e,t):delete l[e]}),n.withCredentials&&(p.withCredentials=!0),n.responseType)try{p.responseType=n.responseType}catch(d){if("json"!==p.responseType)throw d}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(t,e,n){var r;(function(t,o,i){/*! | ||
/* axios v0.5.3 | (c) 2015 by Matt Zabriskie */ | ||
define("axios",[],function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";var r=n(2),o=n(3),i=n(4),s=n(5),u=n(6);!function(){var t=n(9);t&&"function"==typeof t.polyfill&&t.polyfill()}();var c=t.exports=function a(t){t=o.merge({method:"get",headers:{},transformRequest:r.transformRequest,transformResponse:r.transformResponse},t),t.withCredentials=t.withCredentials||r.withCredentials;var e=[s,void 0],n=Promise.resolve(t);for(a.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),a.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n.success=function(t){return i("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(function(e){t(e.data,e.status,e.headers,e.config)}),n},n.error=function(t){return i("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(null,function(e){t(e.data,e.status,e.headers,e.config)}),n},n};c.defaults=r,c.all=function(t){return Promise.all(t)},c.spread=n(7),c.interceptors={request:new u,response:new u},function(){function t(){o.forEach(arguments,function(t){c[t]=function(e,n){return c(o.merge(n||{},{method:t,url:e}))}})}function e(){o.forEach(arguments,function(t){c[t]=function(e,n,r){return c(o.merge(r||{},{method:t,url:e,data:n}))}})}t("delete","get","head"),e("post","put","patch")}()},function(t,e,n){"use strict";var r=n(3),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,e){return r.isArrayBuffer(t)?t:r.isArrayBufferView(t)?t.buffer:!r.isObject(t)||r.isFile(t)||r.isBlob(t)?t:(!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]="application/json;charset=utf-8"),JSON.stringify(t))}],transformResponse:[function(t){if("string"==typeof t){t=t.replace(o,"");try{t=JSON.parse(t)}catch(e){}}return t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(i),post:r.merge(i),put:r.merge(i)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t){"use strict";function e(t){return"[object Array]"===m.call(t)}function n(t){return"[object ArrayBuffer]"===m.call(t)}function r(t){return"[object FormData]"===m.call(t)}function o(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function i(t){return"string"==typeof t}function s(t){return"number"==typeof t}function u(t){return"undefined"==typeof t}function c(t){return null!==t&&"object"==typeof t}function a(t){return"[object Date]"===m.call(t)}function f(t){return"[object File]"===m.call(t)}function l(t){return"[object Blob]"===m.call(t)}function p(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function h(t,n){if(null!==t&&"undefined"!=typeof t){var r=e(t)||"object"==typeof t&&!isNaN(t.length);if("object"==typeof t||r||(t=[t]),r)for(var o=0,i=t.length;i>o;o++)n.call(null,t[o],o,t);else for(var s in t)t.hasOwnProperty(s)&&n.call(null,t[s],s,t)}}function d(){var t={};return h(arguments,function(e){h(e,function(e,n){t[n]=e})}),t}var m=Object.prototype.toString;t.exports={isArray:e,isArrayBuffer:n,isFormData:r,isArrayBufferView:o,isString:i,isNumber:s,isObject:c,isUndefined:u,isDate:a,isFile:f,isBlob:l,forEach:h,merge:d,trim:p}},function(t){"use strict";t.exports=function(t,e,n){try{console.warn("DEPRECATED method `"+t+"`."+(e?" Use `"+e+"` instead.":"")+" This method will be removed in a future release."),n&&console.warn("For more information about usage see "+n)}catch(r){}}},function(t,e,n){(function(e){"use strict";t.exports=function(t){return new Promise(function(r,o){try{"undefined"!=typeof window?n(8)(r,o,t):"undefined"!=typeof e&&n(8)(r,o,t)}catch(i){o(i)}})}}).call(e,n(10))},function(t,e,n){"use strict";function r(){this.handlers=[]}var o=n(3);r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=r},function(t){"use strict";t.exports=function(t){return function(e){t.apply(null,e)}}},function(t,e,n){"use strict";var r=n(2),o=n(3),i=n(11),s=n(12),u=n(13),c=n(14),a=n(15);t.exports=function(t,e,n){var f=c(n.data,n.headers,n.transformRequest),l=o.merge(r.headers.common,r.headers[n.method]||{},n.headers||{});o.isFormData(f)&&delete l["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method.toUpperCase(),i(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=u(p.getAllResponseHeaders()),o=-1!==["text",""].indexOf(n.responseType||"")?p.responseText:p.response,i={data:c(o,r,n.transformResponse),status:p.status,statusText:p.statusText,headers:r,config:n};(p.status>=200&&p.status<300?t:e)(i),p=null}};var h=a(n.url)?s.read(n.xsrfCookieName||r.xsrfCookieName):void 0;if(h&&(l[n.xsrfHeaderName||r.xsrfHeaderName]=h),o.forEach(l,function(t,e){f||"content-type"!==e.toLowerCase()?p.setRequestHeader(e,t):delete l[e]}),n.withCredentials&&(p.withCredentials=!0),n.responseType)try{p.responseType=n.responseType}catch(d){if("json"!==p.responseType)throw d}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(t,e,n){var r;(function(t,o,i){/*! | ||
* @overview es6-promise - a tiny implementation of Promises/A+. | ||
@@ -9,3 +9,3 @@ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) | ||
*/ | ||
(function(){"use strict";function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function u(t){return"function"==typeof t}function a(t){return"object"==typeof t&&null!==t}function c(){}function f(){return function(){t.nextTick(d)}}function l(){var t=0,e=new X(d),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function p(){var t=new MessageChannel;return t.port1.onmessage=d,function(){t.port2.postMessage(0)}}function h(){return function(){setTimeout(d,1)}}function d(){for(var t=0;H>t;t+=2){var e=$[t],n=$[t+1];e(n),$[t]=void 0,$[t+1]=void 0}H=0}function m(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function v(){return new TypeError("A promises callback cannot return that same promise.")}function w(t){try{return t.then}catch(e){return z.error=e,z}}function g(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function b(t,e,n){L(function(t){var r=!1,o=g(n,e,function(n){r||(r=!0,e!==n?A(t,n):j(t,n))},function(e){r||(r=!0,T(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,T(t,o))},t)}function _(t,e){e._state===K?j(t,e._result):t._state===Y?T(t,e._result):C(e,void 0,function(e){A(t,e)},function(e){T(t,e)})}function x(t,e){if(e.constructor===t.constructor)_(t,e);else{var n=w(e);n===z?T(t,z.error):void 0===n?j(t,e):u(n)?b(t,e,n):j(t,e)}}function A(t,e){t===e?T(t,y()):s(e)?x(t,e):j(t,e)}function E(t){t._onerror&&t._onerror(t._result),R(t)}function j(t,e){t._state===J&&(t._result=e,t._state=K,0===t._subscribers.length||L(R,t))}function T(t,e){t._state===J&&(t._state=Y,t._result=e,L(E,t))}function C(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+K]=n,o[i+Y]=r,0===i&&t._state&&L(R,t)}function R(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?P(n,r,o,i):o(i);t._subscribers.length=0}}function S(){this.error=null}function O(t,e){try{return t(e)}catch(n){return G.error=n,G}}function P(t,e,n,r){var o,i,s,a,c=u(n);if(c){if(o=O(n,r),o===G?(a=!0,i=o.error,o=null):s=!0,e===o)return void T(e,v())}else o=r,s=!0;e._state!==J||(c&&s?A(e,o):a?T(e,i):t===K?j(e,o):t===Y&&T(e,o))}function k(t,e){try{e(function(e){A(t,e)},function(e){T(t,e)})}catch(n){T(t,n)}}function D(t,e,n,r){this._instanceConstructor=t,this.promise=new t(m,r),this._abortOnReject=n,this._validateInput(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._init(),0===this.length?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&j(this.promise,this._result))):T(this.promise,this._validationError())}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function M(t){this._id=ne++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&(u(t)||N(),this instanceof M||B(),k(this,t))}var F;F=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var U,q=F,H=(Date.now||function(){return(new Date).getTime()},Object.create||function(t){if(arguments.length>1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return c.prototype=t,new c},0),L=function(t,e){$[H]=t,$[H+1]=e,H+=2,2===H&&U()},I="undefined"!=typeof window?window:{},X=I.MutationObserver||I.WebKitMutationObserver,V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3);U="undefined"!=typeof t&&"[object process]"==={}.toString.call(t)?f():X?l():V?p():h();var J=void 0,K=1,Y=2,z=new S,G=new S;D.prototype._validateInput=function(t){return q(t)},D.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},D.prototype._init=function(){this._result=new Array(this.length)};var W=D;D.prototype._enumerate=function(){for(var t=this.length,e=this.promise,n=this._input,r=0;e._state===J&&t>r;r++)this._eachEntry(n[r],r)},D.prototype._eachEntry=function(t,e){var n=this._instanceConstructor;a(t)?t.constructor===n&&t._state!==J?(t._onerror=null,this._settledAt(t._state,e,t._result)):this._willSettleAt(n.resolve(t),e):(this._remaining--,this._result[e]=this._makeResult(K,e,t))},D.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===J&&(this._remaining--,this._abortOnReject&&t===Y?T(r,n):this._result[e]=this._makeResult(t,e,n)),0===this._remaining&&j(r,this._result)},D.prototype._makeResult=function(t,e,n){return n},D.prototype._willSettleAt=function(t,e){var n=this;C(t,void 0,function(t){n._settledAt(K,e,t)},function(t){n._settledAt(Y,e,t)})};var Q=function(t,e){return new W(this,t,!0,e).promise},Z=function(t,e){function n(t){A(i,t)}function r(t){T(i,t)}var o=this,i=new o(m,e);if(!q(t))return T(i,new TypeError("You must pass an array to race.")),i;for(var s=t.length,u=0;i._state===J&&s>u;u++)C(o.resolve(t[u]),void 0,n,r);return i},te=function(t,e){var n=this;if(t&&"object"==typeof t&&t.constructor===n)return t;var r=new n(m,e);return A(r,t),r},ee=function(t,e){var n=this,r=new n(m,e);return T(r,t),r},ne=0,re=M;M.all=Q,M.race=Z,M.resolve=te,M.reject=ee,M.prototype={constructor:M,then:function(t,e){var n=this,r=n._state;if(r===K&&!t||r===Y&&!e)return this;var o=new this.constructor(m),i=n._result;if(r){var s=arguments[r-1];L(function(){P(r,o,s,i)})}else C(n,o,t,e);return o},"catch":function(t){return this.then(null,t)}};var oe=function(){var t;t="undefined"!=typeof o?o:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),u(e)}();e||(t.Promise=re)},ie={Promise:re,polyfill:oe};n(16).amd?(r=function(){return ie}.call(e,n,e,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=ie:"undefined"!=typeof this&&(this.ES6Promise=ie)}).call(this)}).call(e,n(10),function(){return this}(),n(17)(t))},function(t){function e(){if(!i){i=!0;for(var t,e=o.length;e;){t=o,o=[];for(var n=-1;++n<e;)t[n]();e=o.length}i=!1}}function n(){}var r=t.exports={},o=[],i=!1;r.nextTick=function(t){o.push(t),i||setTimeout(e,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}var o=n(3);t.exports=function(t,e){if(!e)return t;var n=[];return o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),n.push(r(e)+"="+r(t))}))}),n.length>0&&(t+=(-1===t.indexOf("?")?"?":"&")+n.join("&")),t}},function(t,e,n){"use strict";var r=n(3);t.exports={write:function(t,e,n,o,i,s){var u=[];u.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t){var e,n,o,i={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e&&(i[e]=i[e]?i[e]+", "+n:n)}),i):i}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";function r(t){var e=t;return o&&(s.setAttribute("href",e),e=s.href),s.setAttribute("href",e),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:"/"===s.pathname.charAt(0)?s.pathname:"/"+s.pathname}}var o=/(msie|trident)/i.test(navigator.userAgent),i=n(3),s=document.createElement("a"),u=r(window.location.href);t.exports=function(t){var e=i.isString(t)?r(t):t;return e.protocol===u.protocol&&e.host===u.host}},function(t){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}}])}); | ||
(function(){"use strict";function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function u(t){return"function"==typeof t}function c(t){return"object"==typeof t&&null!==t}function a(){}function f(){return function(){t.nextTick(d)}}function l(){var t=0,e=new X(d),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function p(){var t=new MessageChannel;return t.port1.onmessage=d,function(){t.port2.postMessage(0)}}function h(){return function(){setTimeout(d,1)}}function d(){for(var t=0;H>t;t+=2){var e=J[t],n=J[t+1];e(n),J[t]=void 0,J[t+1]=void 0}H=0}function m(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function v(){return new TypeError("A promises callback cannot return that same promise.")}function w(t){try{return t.then}catch(e){return z.error=e,z}}function g(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function b(t,e,n){L(function(t){var r=!1,o=g(n,e,function(n){r||(r=!0,e!==n?A(t,n):j(t,n))},function(e){r||(r=!0,T(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,T(t,o))},t)}function _(t,e){e._state===Y?j(t,e._result):t._state===$?T(t,e._result):C(e,void 0,function(e){A(t,e)},function(e){T(t,e)})}function x(t,e){if(e.constructor===t.constructor)_(t,e);else{var n=w(e);n===z?T(t,z.error):void 0===n?j(t,e):u(n)?b(t,e,n):j(t,e)}}function A(t,e){t===e?T(t,y()):s(e)?x(t,e):j(t,e)}function E(t){t._onerror&&t._onerror(t._result),R(t)}function j(t,e){t._state===K&&(t._result=e,t._state=Y,0===t._subscribers.length||L(R,t))}function T(t,e){t._state===K&&(t._state=$,t._result=e,L(E,t))}function C(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+Y]=n,o[i+$]=r,0===i&&t._state&&L(R,t)}function R(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?P(n,r,o,i):o(i);t._subscribers.length=0}}function S(){this.error=null}function O(t,e){try{return t(e)}catch(n){return G.error=n,G}}function P(t,e,n,r){var o,i,s,c,a=u(n);if(a){if(o=O(n,r),o===G?(c=!0,i=o.error,o=null):s=!0,e===o)return void T(e,v())}else o=r,s=!0;e._state!==K||(a&&s?A(e,o):c?T(e,i):t===Y?j(e,o):t===$&&T(e,o))}function k(t,e){try{e(function(e){A(t,e)},function(e){T(t,e)})}catch(n){T(t,n)}}function D(t,e,n,r){this._instanceConstructor=t,this.promise=new t(m,r),this._abortOnReject=n,this._validateInput(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._init(),0===this.length?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&j(this.promise,this._result))):T(this.promise,this._validationError())}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function M(t){this._id=ne++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&(u(t)||N(),this instanceof M||B(),k(this,t))}var F;F=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var U,q=F,H=(Date.now||function(){return(new Date).getTime()},Object.create||function(t){if(arguments.length>1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return a.prototype=t,new a},0),L=function(t,e){J[H]=t,J[H+1]=e,H+=2,2===H&&U()},I="undefined"!=typeof window?window:{},X=I.MutationObserver||I.WebKitMutationObserver,V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,J=new Array(1e3);U="undefined"!=typeof t&&"[object process]"==={}.toString.call(t)?f():X?l():V?p():h();var K=void 0,Y=1,$=2,z=new S,G=new S;D.prototype._validateInput=function(t){return q(t)},D.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},D.prototype._init=function(){this._result=new Array(this.length)};var W=D;D.prototype._enumerate=function(){for(var t=this.length,e=this.promise,n=this._input,r=0;e._state===K&&t>r;r++)this._eachEntry(n[r],r)},D.prototype._eachEntry=function(t,e){var n=this._instanceConstructor;c(t)?t.constructor===n&&t._state!==K?(t._onerror=null,this._settledAt(t._state,e,t._result)):this._willSettleAt(n.resolve(t),e):(this._remaining--,this._result[e]=this._makeResult(Y,e,t))},D.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===K&&(this._remaining--,this._abortOnReject&&t===$?T(r,n):this._result[e]=this._makeResult(t,e,n)),0===this._remaining&&j(r,this._result)},D.prototype._makeResult=function(t,e,n){return n},D.prototype._willSettleAt=function(t,e){var n=this;C(t,void 0,function(t){n._settledAt(Y,e,t)},function(t){n._settledAt($,e,t)})};var Q=function(t,e){return new W(this,t,!0,e).promise},Z=function(t,e){function n(t){A(i,t)}function r(t){T(i,t)}var o=this,i=new o(m,e);if(!q(t))return T(i,new TypeError("You must pass an array to race.")),i;for(var s=t.length,u=0;i._state===K&&s>u;u++)C(o.resolve(t[u]),void 0,n,r);return i},te=function(t,e){var n=this;if(t&&"object"==typeof t&&t.constructor===n)return t;var r=new n(m,e);return A(r,t),r},ee=function(t,e){var n=this,r=new n(m,e);return T(r,t),r},ne=0,re=M;M.all=Q,M.race=Z,M.resolve=te,M.reject=ee,M.prototype={constructor:M,then:function(t,e){var n=this,r=n._state;if(r===Y&&!t||r===$&&!e)return this;var o=new this.constructor(m),i=n._result;if(r){var s=arguments[r-1];L(function(){P(r,o,s,i)})}else C(n,o,t,e);return o},"catch":function(t){return this.then(null,t)}};var oe=function(){var t;t="undefined"!=typeof o?o:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),u(e)}();e||(t.Promise=re)},ie={Promise:re,polyfill:oe};n(16).amd?(r=function(){return ie}.call(e,n,e,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=ie:"undefined"!=typeof this&&(this.ES6Promise=ie)}).call(this)}).call(e,n(10),function(){return this}(),n(17)(t))},function(t){function e(){if(!i){i=!0;for(var t,e=o.length;e;){t=o,o=[];for(var n=-1;++n<e;)t[n]();e=o.length}i=!1}}function n(){}var r=t.exports={},o=[],i=!1;r.nextTick=function(t){o.push(t),i||setTimeout(e,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}var o=n(3);t.exports=function(t,e){if(!e)return t;var n=[];return o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),n.push(r(e)+"="+r(t))}))}),n.length>0&&(t+=(-1===t.indexOf("?")?"?":"&")+n.join("&")),t}},function(t,e,n){"use strict";var r=n(3);t.exports={write:function(t,e,n,o,i,s){var u=[];u.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t){var e,n,o,i={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e&&(i[e]=i[e]?i[e]+", "+n:n)}),i):i}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";function r(t){var e=t;return s&&(u.setAttribute("href",e),e=u.href),u.setAttribute("href",e),{href:u.href,protocol:u.protocol?u.protocol.replace(/:$/,""):"",host:u.host,search:u.search?u.search.replace(/^\?/,""):"",hash:u.hash?u.hash.replace(/^#/,""):"",hostname:u.hostname,port:u.port,pathname:"/"===u.pathname.charAt(0)?u.pathname:"/"+u.pathname}}var o,i=n(3),s=/(msie|trident)/i.test(navigator.userAgent),u=document.createElement("a");o=r(window.location.href),t.exports=function(t){var e=i.isString(t)?r(t):t;return e.protocol===o.protocol&&e.host===o.host}},function(t){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}}])}); | ||
//# sourceMappingURL=axios.amd.min.map |
@@ -53,2 +53,4 @@ define("axios", ["{Promise: Promise}"], function(__WEBPACK_EXTERNAL_MODULE_2__) { return /******/ (function(modules) { // webpackBootstrap | ||
'use strict'; | ||
var defaults = __webpack_require__(3); | ||
@@ -136,28 +138,29 @@ var utils = __webpack_require__(4); | ||
// Provide aliases for supported request methods | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
(function () { | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
})(); | ||
@@ -179,4 +182,2 @@ | ||
var JSON_START = /^\s*(\[|\{[^\{])/; | ||
var JSON_END = /[\}\]]\s*$/; | ||
var PROTECTION_PREFIX = /^\)\]\}',?\n/; | ||
@@ -208,5 +209,5 @@ var DEFAULT_CONTENT_TYPE = { | ||
data = data.replace(PROTECTION_PREFIX, ''); | ||
if (JSON_START.test(data) && JSON_END.test(data)) { | ||
try { | ||
data = JSON.parse(data); | ||
} | ||
} catch (e) {} | ||
} | ||
@@ -229,2 +230,3 @@ return data; | ||
/***/ }, | ||
@@ -234,2 +236,6 @@ /* 4 */ | ||
'use strict'; | ||
/*global toString:true*/ | ||
// utils is a library of generic helper functions non-specific to axios | ||
@@ -391,3 +397,3 @@ | ||
if (isArrayLike) { | ||
for (var i=0, l=obj.length; i<l; i++) { | ||
for (var i = 0, l = obj.length; i < l; i++) { | ||
fn.call(null, obj[i], i, obj); | ||
@@ -423,3 +429,3 @@ } | ||
*/ | ||
function merge(obj1/*, obj2, obj3, ...*/) { | ||
function merge(/*obj1, obj2, obj3, ...*/) { | ||
var result = {}; | ||
@@ -523,3 +529,3 @@ forEach(arguments, function (obj) { | ||
this.handlers = []; | ||
}; | ||
} | ||
@@ -565,3 +571,3 @@ /** | ||
fn(h); | ||
} | ||
} | ||
}); | ||
@@ -571,3 +577,2 @@ }; | ||
module.exports = InterceptorManager; | ||
@@ -579,2 +584,4 @@ | ||
'use strict'; | ||
/** | ||
@@ -606,2 +613,3 @@ * Syntactic sugar for invoking a function and expanding an array for arguments. | ||
/***/ }, | ||
@@ -611,2 +619,6 @@ /* 9 */ | ||
'use strict'; | ||
/*global ActiveXObject:true*/ | ||
var defaults = __webpack_require__(3); | ||
@@ -629,3 +641,3 @@ var utils = __webpack_require__(4); | ||
// Merge headers | ||
var headers = utils.merge( | ||
var requestHeaders = utils.merge( | ||
defaults.headers.common, | ||
@@ -637,7 +649,7 @@ defaults.headers[config.method] || {}, | ||
if (utils.isFormData(data)) { | ||
delete headers['Content-Type']; // Let the browser set it | ||
delete requestHeaders['Content-Type']; // Let the browser set it | ||
} | ||
// Create the request | ||
var request = new(XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
var request = new (XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
request.open(config.method.toUpperCase(), buildUrl(config.url, config.params), true); | ||
@@ -649,3 +661,3 @@ | ||
// Prepare the response | ||
var headers = parseHeaders(request.getAllResponseHeaders()); | ||
var responseHeaders = parseHeaders(request.getAllResponseHeaders()); | ||
var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response; | ||
@@ -655,3 +667,3 @@ var response = { | ||
responseData, | ||
headers, | ||
responseHeaders, | ||
config.transformResponse | ||
@@ -661,3 +673,3 @@ ), | ||
statusText: request.statusText, | ||
headers: headers, | ||
headers: responseHeaders, | ||
config: config | ||
@@ -667,5 +679,5 @@ }; | ||
// Resolve or reject the Promise based on the status | ||
(request.status >= 200 && request.status < 300 | ||
? resolve | ||
: reject)(response); | ||
(request.status >= 200 && request.status < 300 ? | ||
resolve : | ||
reject)(response); | ||
@@ -678,14 +690,14 @@ // Clean up request | ||
// Add xsrf header | ||
var xsrfValue = urlIsSameOrigin(config.url) | ||
? cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) | ||
: undefined; | ||
var xsrfValue = urlIsSameOrigin(config.url) ? | ||
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) : | ||
undefined; | ||
if (xsrfValue) { | ||
headers[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
requestHeaders[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
} | ||
// Add headers to the request | ||
utils.forEach(headers, function (val, key) { | ||
utils.forEach(requestHeaders, function (val, key) { | ||
// Remove Content-Type if data is undefined | ||
if (!data && key.toLowerCase() === 'content-type') { | ||
delete headers[key]; | ||
delete requestHeaders[key]; | ||
} | ||
@@ -887,2 +899,3 @@ // Otherwise add header to the request | ||
/***/ }, | ||
@@ -912,3 +925,3 @@ /* 13 */ | ||
if (!headers) return parsed; | ||
if (!headers) { return parsed; } | ||
@@ -928,2 +941,3 @@ utils.forEach(headers.split('\n'), function(line) { | ||
/***/ }, | ||
@@ -953,2 +967,3 @@ /* 14 */ | ||
/***/ }, | ||
@@ -960,6 +975,6 @@ /* 15 */ | ||
var utils = __webpack_require__(4); | ||
var msie = /(msie|trident)/i.test(navigator.userAgent); | ||
var utils = __webpack_require__(4); | ||
var urlParsingNode = document.createElement('a'); | ||
var originUrl = urlResolve(window.location.href); | ||
var originUrl; | ||
@@ -992,8 +1007,10 @@ /** | ||
port: urlParsingNode.port, | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') | ||
? urlParsingNode.pathname | ||
: '/' + urlParsingNode.pathname | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') ? | ||
urlParsingNode.pathname : | ||
'/' + urlParsingNode.pathname | ||
}; | ||
} | ||
originUrl = urlResolve(window.location.href); | ||
/** | ||
@@ -1011,4 +1028,5 @@ * Determine if a URL shares the same origin as the current location | ||
/***/ } | ||
/******/ ])});; | ||
//# sourceMappingURL=axios.amd.standalone.map |
@@ -1,3 +0,3 @@ | ||
/* axios v0.5.2 | (c) 2015 by Matt Zabriskie */ | ||
define("axios",["{Promise: Promise}"],function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){function r(){s.forEach(arguments,function(e){f[e]=function(t,n){return f(s.merge(n||{},{method:e,url:t}))}})}function o(){s.forEach(arguments,function(e){f[e]=function(t,n,r){return f(s.merge(r||{},{method:e,url:t,data:n}))}})}var i=n(3),s=n(4),u=n(5),a=n(6),c=n(7);!function(){var e=n(2);e&&"function"==typeof e.polyfill&&e.polyfill()}();var f=e.exports=function l(e){e=s.merge({method:"get",headers:{},transformRequest:i.transformRequest,transformResponse:i.transformResponse},e),e.withCredentials=e.withCredentials||i.withCredentials;var t=[a,void 0],n=Promise.resolve(e);for(l.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),l.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n.success=function(e){return u("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(function(t){e(t.data,t.status,t.headers,t.config)}),n},n.error=function(e){return u("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(null,function(t){e(t.data,t.status,t.headers,t.config)}),n},n};f.defaults=i,f.all=function(e){return Promise.all(e)},f.spread=n(8),f.interceptors={request:new c,response:new c},r("delete","get","head"),o("post","put","patch")},function(t){t.exports=e},function(e,t,n){"use strict";var r=n(4),o=/^\s*(\[|\{[^\{])/,i=/[\}\]]\s*$/,s=/^\)\]\}',?\n/,u={"Content-Type":"application/x-www-form-urlencoded"};e.exports={transformRequest:[function(e,t){return r.isArrayBuffer(e)?e:r.isArrayBufferView(e)?e.buffer:!r.isObject(e)||r.isFile(e)||r.isBlob(e)?e:(!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]="application/json;charset=utf-8"),JSON.stringify(e))}],transformResponse:[function(e){return"string"==typeof e&&(e=e.replace(s,""),o.test(e)&&i.test(e)&&(e=JSON.parse(e))),e}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(u),post:r.merge(u),put:r.merge(u)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(e){function t(e){return"[object Array]"===m.call(e)}function n(e){return"[object ArrayBuffer]"===m.call(e)}function r(e){return"[object FormData]"===m.call(e)}function o(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function i(e){return"string"==typeof e}function s(e){return"number"==typeof e}function u(e){return"undefined"==typeof e}function a(e){return null!==e&&"object"==typeof e}function c(e){return"[object Date]"===m.call(e)}function f(e){return"[object File]"===m.call(e)}function l(e){return"[object Blob]"===m.call(e)}function p(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function h(e,n){if(null!==e&&"undefined"!=typeof e){var r=t(e)||"object"==typeof e&&!isNaN(e.length);if("object"==typeof e||r||(e=[e]),r)for(var o=0,i=e.length;i>o;o++)n.call(null,e[o],o,e);else for(var s in e)e.hasOwnProperty(s)&&n.call(null,e[s],s,e)}}function d(){var e={};return h(arguments,function(t){h(t,function(t,n){e[n]=t})}),e}var m=Object.prototype.toString;e.exports={isArray:t,isArrayBuffer:n,isFormData:r,isArrayBufferView:o,isString:i,isNumber:s,isObject:a,isUndefined:u,isDate:c,isFile:f,isBlob:l,forEach:h,merge:d,trim:p}},function(e){"use strict";e.exports=function(e,t,n){try{console.warn("DEPRECATED method `"+e+"`."+(t?" Use `"+t+"` instead.":"")+" This method will be removed in a future release."),n&&console.warn("For more information about usage see "+n)}catch(r){}}},function(e,t,n){(function(t){"use strict";e.exports=function(e){return new Promise(function(r,o){try{"undefined"!=typeof window?n(9)(r,o,e):"undefined"!=typeof t&&n(9)(r,o,e)}catch(i){o(i)}})}}).call(t,n(10))},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(4);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e){e.exports=function(e){return function(t){e.apply(null,t)}}},function(e,t,n){var r=n(3),o=n(4),i=n(11),s=n(12),u=n(13),a=n(14),c=n(15);e.exports=function(e,t,n){var f=a(n.data,n.headers,n.transformRequest),l=o.merge(r.headers.common,r.headers[n.method]||{},n.headers||{});o.isFormData(f)&&delete l["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method.toUpperCase(),i(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=u(p.getAllResponseHeaders()),o=-1!==["text",""].indexOf(n.responseType||"")?p.responseText:p.response,i={data:a(o,r,n.transformResponse),status:p.status,statusText:p.statusText,headers:r,config:n};(p.status>=200&&p.status<300?e:t)(i),p=null}};var h=c(n.url)?s.read(n.xsrfCookieName||r.xsrfCookieName):void 0;if(h&&(l[n.xsrfHeaderName||r.xsrfHeaderName]=h),o.forEach(l,function(e,t){f||"content-type"!==t.toLowerCase()?p.setRequestHeader(t,e):delete l[t]}),n.withCredentials&&(p.withCredentials=!0),n.responseType)try{p.responseType=n.responseType}catch(d){if("json"!==p.responseType)throw d}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(e){function t(){if(!i){i=!0;for(var e,t=o.length;t;){e=o,o=[];for(var n=-1;++n<t;)e[n]();t=o.length}i=!1}}function n(){}var r=e.exports={},o=[],i=!1;r.nextTick=function(e){o.push(e),i||setTimeout(t,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}var o=n(4);e.exports=function(e,t){if(!t)return e;var n=[];return o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)||(e=[e]),o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),n.push(r(t)+"="+r(e))}))}),n.length>0&&(e+=(-1===e.indexOf("?")?"?":"&")+n.join("&")),e}},function(e,t,n){"use strict";var r=n(4);e.exports={write:function(e,t,n,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.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(e,t,n){"use strict";var r=n(4);e.exports=function(e){var t,n,o,i={};return e?(r.forEach(e.split("\n"),function(e){o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t&&(i[t]=i[t]?i[t]+", "+n:n)}),i):i}},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";function r(e){var t=e;return o&&(s.setAttribute("href",t),t=s.href),s.setAttribute("href",t),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:"/"===s.pathname.charAt(0)?s.pathname:"/"+s.pathname}}var o=/(msie|trident)/i.test(navigator.userAgent),i=n(4),s=document.createElement("a"),u=r(window.location.href);e.exports=function(e){var t=i.isString(e)?r(e):e;return t.protocol===u.protocol&&t.host===u.host}}])}); | ||
/* axios v0.5.3 | (c) 2015 by Matt Zabriskie */ | ||
define("axios",["{Promise: Promise}"],function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";var r=n(3),o=n(4),i=n(5),s=n(6),u=n(7);!function(){var t=n(2);t&&"function"==typeof t.polyfill&&t.polyfill()}();var a=t.exports=function c(t){t=o.merge({method:"get",headers:{},transformRequest:r.transformRequest,transformResponse:r.transformResponse},t),t.withCredentials=t.withCredentials||r.withCredentials;var e=[s,void 0],n=Promise.resolve(t);for(c.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),c.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n.success=function(t){return i("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(function(e){t(e.data,e.status,e.headers,e.config)}),n},n.error=function(t){return i("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(null,function(e){t(e.data,e.status,e.headers,e.config)}),n},n};a.defaults=r,a.all=function(t){return Promise.all(t)},a.spread=n(8),a.interceptors={request:new u,response:new u},function(){function t(){o.forEach(arguments,function(t){a[t]=function(e,n){return a(o.merge(n||{},{method:t,url:e}))}})}function e(){o.forEach(arguments,function(t){a[t]=function(e,n,r){return a(o.merge(r||{},{method:t,url:e,data:n}))}})}t("delete","get","head"),e("post","put","patch")}()},function(e){e.exports=t},function(t,e,n){"use strict";var r=n(4),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,e){return r.isArrayBuffer(t)?t:r.isArrayBufferView(t)?t.buffer:!r.isObject(t)||r.isFile(t)||r.isBlob(t)?t:(!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]="application/json;charset=utf-8"),JSON.stringify(t))}],transformResponse:[function(t){if("string"==typeof t){t=t.replace(o,"");try{t=JSON.parse(t)}catch(e){}}return t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(i),post:r.merge(i),put:r.merge(i)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t){"use strict";function e(t){return"[object Array]"===m.call(t)}function n(t){return"[object ArrayBuffer]"===m.call(t)}function r(t){return"[object FormData]"===m.call(t)}function o(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function i(t){return"string"==typeof t}function s(t){return"number"==typeof t}function u(t){return"undefined"==typeof t}function a(t){return null!==t&&"object"==typeof t}function c(t){return"[object Date]"===m.call(t)}function f(t){return"[object File]"===m.call(t)}function l(t){return"[object Blob]"===m.call(t)}function p(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function h(t,n){if(null!==t&&"undefined"!=typeof t){var r=e(t)||"object"==typeof t&&!isNaN(t.length);if("object"==typeof t||r||(t=[t]),r)for(var o=0,i=t.length;i>o;o++)n.call(null,t[o],o,t);else for(var s in t)t.hasOwnProperty(s)&&n.call(null,t[s],s,t)}}function d(){var t={};return h(arguments,function(e){h(e,function(e,n){t[n]=e})}),t}var m=Object.prototype.toString;t.exports={isArray:e,isArrayBuffer:n,isFormData:r,isArrayBufferView:o,isString:i,isNumber:s,isObject:a,isUndefined:u,isDate:c,isFile:f,isBlob:l,forEach:h,merge:d,trim:p}},function(t){"use strict";t.exports=function(t,e,n){try{console.warn("DEPRECATED method `"+t+"`."+(e?" Use `"+e+"` instead.":"")+" This method will be removed in a future release."),n&&console.warn("For more information about usage see "+n)}catch(r){}}},function(t,e,n){(function(e){"use strict";t.exports=function(t){return new Promise(function(r,o){try{"undefined"!=typeof window?n(9)(r,o,t):"undefined"!=typeof e&&n(9)(r,o,t)}catch(i){o(i)}})}}).call(e,n(10))},function(t,e,n){"use strict";function r(){this.handlers=[]}var o=n(4);r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=r},function(t){"use strict";t.exports=function(t){return function(e){t.apply(null,e)}}},function(t,e,n){"use strict";var r=n(3),o=n(4),i=n(11),s=n(12),u=n(13),a=n(14),c=n(15);t.exports=function(t,e,n){var f=a(n.data,n.headers,n.transformRequest),l=o.merge(r.headers.common,r.headers[n.method]||{},n.headers||{});o.isFormData(f)&&delete l["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method.toUpperCase(),i(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=u(p.getAllResponseHeaders()),o=-1!==["text",""].indexOf(n.responseType||"")?p.responseText:p.response,i={data:a(o,r,n.transformResponse),status:p.status,statusText:p.statusText,headers:r,config:n};(p.status>=200&&p.status<300?t:e)(i),p=null}};var h=c(n.url)?s.read(n.xsrfCookieName||r.xsrfCookieName):void 0;if(h&&(l[n.xsrfHeaderName||r.xsrfHeaderName]=h),o.forEach(l,function(t,e){f||"content-type"!==e.toLowerCase()?p.setRequestHeader(e,t):delete l[e]}),n.withCredentials&&(p.withCredentials=!0),n.responseType)try{p.responseType=n.responseType}catch(d){if("json"!==p.responseType)throw d}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(t){function e(){if(!i){i=!0;for(var t,e=o.length;e;){t=o,o=[];for(var n=-1;++n<e;)t[n]();e=o.length}i=!1}}function n(){}var r=t.exports={},o=[],i=!1;r.nextTick=function(t){o.push(t),i||setTimeout(e,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}var o=n(4);t.exports=function(t,e){if(!e)return t;var n=[];return o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),n.push(r(e)+"="+r(t))}))}),n.length>0&&(t+=(-1===t.indexOf("?")?"?":"&")+n.join("&")),t}},function(t,e,n){"use strict";var r=n(4);t.exports={write:function(t,e,n,o,i,s){var u=[];u.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t){var e,n,o,i={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e&&(i[e]=i[e]?i[e]+", "+n:n)}),i):i}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";function r(t){var e=t;return s&&(u.setAttribute("href",e),e=u.href),u.setAttribute("href",e),{href:u.href,protocol:u.protocol?u.protocol.replace(/:$/,""):"",host:u.host,search:u.search?u.search.replace(/^\?/,""):"",hash:u.hash?u.hash.replace(/^#/,""):"",hostname:u.hostname,port:u.port,pathname:"/"===u.pathname.charAt(0)?u.pathname:"/"+u.pathname}}var o,i=n(4),s=/(msie|trident)/i.test(navigator.userAgent),u=document.createElement("a");o=r(window.location.href),t.exports=function(t){var e=i.isString(t)?r(t):t;return e.protocol===o.protocol&&e.host===o.host}}])}); | ||
//# sourceMappingURL=axios.amd.standalone.min.map |
@@ -54,2 +54,4 @@ var axios = | ||
'use strict'; | ||
var defaults = __webpack_require__(2); | ||
@@ -137,28 +139,29 @@ var utils = __webpack_require__(3); | ||
// Provide aliases for supported request methods | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
(function () { | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
})(); | ||
@@ -174,4 +177,2 @@ | ||
var JSON_START = /^\s*(\[|\{[^\{])/; | ||
var JSON_END = /[\}\]]\s*$/; | ||
var PROTECTION_PREFIX = /^\)\]\}',?\n/; | ||
@@ -203,5 +204,5 @@ var DEFAULT_CONTENT_TYPE = { | ||
data = data.replace(PROTECTION_PREFIX, ''); | ||
if (JSON_START.test(data) && JSON_END.test(data)) { | ||
try { | ||
data = JSON.parse(data); | ||
} | ||
} catch (e) {} | ||
} | ||
@@ -224,2 +225,3 @@ return data; | ||
/***/ }, | ||
@@ -229,2 +231,6 @@ /* 3 */ | ||
'use strict'; | ||
/*global toString:true*/ | ||
// utils is a library of generic helper functions non-specific to axios | ||
@@ -386,3 +392,3 @@ | ||
if (isArrayLike) { | ||
for (var i=0, l=obj.length; i<l; i++) { | ||
for (var i = 0, l = obj.length; i < l; i++) { | ||
fn.call(null, obj[i], i, obj); | ||
@@ -418,3 +424,3 @@ } | ||
*/ | ||
function merge(obj1/*, obj2, obj3, ...*/) { | ||
function merge(/*obj1, obj2, obj3, ...*/) { | ||
var result = {}; | ||
@@ -518,3 +524,3 @@ forEach(arguments, function (obj) { | ||
this.handlers = []; | ||
}; | ||
} | ||
@@ -560,3 +566,3 @@ /** | ||
fn(h); | ||
} | ||
} | ||
}); | ||
@@ -566,3 +572,2 @@ }; | ||
module.exports = InterceptorManager; | ||
@@ -574,2 +579,4 @@ | ||
'use strict'; | ||
/** | ||
@@ -601,2 +608,3 @@ * Syntactic sugar for invoking a function and expanding an array for arguments. | ||
/***/ }, | ||
@@ -606,2 +614,6 @@ /* 8 */ | ||
'use strict'; | ||
/*global ActiveXObject:true*/ | ||
var defaults = __webpack_require__(2); | ||
@@ -624,3 +636,3 @@ var utils = __webpack_require__(3); | ||
// Merge headers | ||
var headers = utils.merge( | ||
var requestHeaders = utils.merge( | ||
defaults.headers.common, | ||
@@ -632,7 +644,7 @@ defaults.headers[config.method] || {}, | ||
if (utils.isFormData(data)) { | ||
delete headers['Content-Type']; // Let the browser set it | ||
delete requestHeaders['Content-Type']; // Let the browser set it | ||
} | ||
// Create the request | ||
var request = new(XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
var request = new (XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
request.open(config.method.toUpperCase(), buildUrl(config.url, config.params), true); | ||
@@ -644,3 +656,3 @@ | ||
// Prepare the response | ||
var headers = parseHeaders(request.getAllResponseHeaders()); | ||
var responseHeaders = parseHeaders(request.getAllResponseHeaders()); | ||
var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response; | ||
@@ -650,3 +662,3 @@ var response = { | ||
responseData, | ||
headers, | ||
responseHeaders, | ||
config.transformResponse | ||
@@ -656,3 +668,3 @@ ), | ||
statusText: request.statusText, | ||
headers: headers, | ||
headers: responseHeaders, | ||
config: config | ||
@@ -662,5 +674,5 @@ }; | ||
// Resolve or reject the Promise based on the status | ||
(request.status >= 200 && request.status < 300 | ||
? resolve | ||
: reject)(response); | ||
(request.status >= 200 && request.status < 300 ? | ||
resolve : | ||
reject)(response); | ||
@@ -673,14 +685,14 @@ // Clean up request | ||
// Add xsrf header | ||
var xsrfValue = urlIsSameOrigin(config.url) | ||
? cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) | ||
: undefined; | ||
var xsrfValue = urlIsSameOrigin(config.url) ? | ||
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) : | ||
undefined; | ||
if (xsrfValue) { | ||
headers[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
requestHeaders[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
} | ||
// Add headers to the request | ||
utils.forEach(headers, function (val, key) { | ||
utils.forEach(requestHeaders, function (val, key) { | ||
// Remove Content-Type if data is undefined | ||
if (!data && key.toLowerCase() === 'content-type') { | ||
delete headers[key]; | ||
delete requestHeaders[key]; | ||
} | ||
@@ -1848,2 +1860,3 @@ // Otherwise add header to the request | ||
/***/ }, | ||
@@ -1873,3 +1886,3 @@ /* 13 */ | ||
if (!headers) return parsed; | ||
if (!headers) { return parsed; } | ||
@@ -1889,2 +1902,3 @@ utils.forEach(headers.split('\n'), function(line) { | ||
/***/ }, | ||
@@ -1914,2 +1928,3 @@ /* 14 */ | ||
/***/ }, | ||
@@ -1921,6 +1936,6 @@ /* 15 */ | ||
var utils = __webpack_require__(3); | ||
var msie = /(msie|trident)/i.test(navigator.userAgent); | ||
var utils = __webpack_require__(3); | ||
var urlParsingNode = document.createElement('a'); | ||
var originUrl = urlResolve(window.location.href); | ||
var originUrl; | ||
@@ -1953,8 +1968,10 @@ /** | ||
port: urlParsingNode.port, | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') | ||
? urlParsingNode.pathname | ||
: '/' + urlParsingNode.pathname | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') ? | ||
urlParsingNode.pathname : | ||
'/' + urlParsingNode.pathname | ||
}; | ||
} | ||
originUrl = urlResolve(window.location.href); | ||
/** | ||
@@ -1972,2 +1989,3 @@ * Determine if a URL shares the same origin as the current location | ||
/***/ }, | ||
@@ -1974,0 +1992,0 @@ /* 16 */ |
@@ -1,3 +0,3 @@ | ||
/* axios v0.5.2 | (c) 2015 by Matt Zabriskie */ | ||
var axios=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){function r(){s.forEach(arguments,function(t){f[t]=function(e,n){return f(s.merge(n||{},{method:t,url:e}))}})}function o(){s.forEach(arguments,function(t){f[t]=function(e,n,r){return f(s.merge(r||{},{method:t,url:e,data:n}))}})}var i=n(2),s=n(3),u=n(4),a=n(5),c=n(6);!function(){var t=n(9);t&&"function"==typeof t.polyfill&&t.polyfill()}();var f=t.exports=function l(t){t=s.merge({method:"get",headers:{},transformRequest:i.transformRequest,transformResponse:i.transformResponse},t),t.withCredentials=t.withCredentials||i.withCredentials;var e=[a,void 0],n=Promise.resolve(t);for(l.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),l.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n.success=function(t){return u("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(function(e){t(e.data,e.status,e.headers,e.config)}),n},n.error=function(t){return u("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(null,function(e){t(e.data,e.status,e.headers,e.config)}),n},n};f.defaults=i,f.all=function(t){return Promise.all(t)},f.spread=n(7),f.interceptors={request:new c,response:new c},r("delete","get","head"),o("post","put","patch")},function(t,e,n){"use strict";var r=n(3),o=/^\s*(\[|\{[^\{])/,i=/[\}\]]\s*$/,s=/^\)\]\}',?\n/,u={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,e){return r.isArrayBuffer(t)?t:r.isArrayBufferView(t)?t.buffer:!r.isObject(t)||r.isFile(t)||r.isBlob(t)?t:(!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]="application/json;charset=utf-8"),JSON.stringify(t))}],transformResponse:[function(t){return"string"==typeof t&&(t=t.replace(s,""),o.test(t)&&i.test(t)&&(t=JSON.parse(t))),t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(u),post:r.merge(u),put:r.merge(u)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t){function e(t){return"[object Array]"===m.call(t)}function n(t){return"[object ArrayBuffer]"===m.call(t)}function r(t){return"[object FormData]"===m.call(t)}function o(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function i(t){return"string"==typeof t}function s(t){return"number"==typeof t}function u(t){return"undefined"==typeof t}function a(t){return null!==t&&"object"==typeof t}function c(t){return"[object Date]"===m.call(t)}function f(t){return"[object File]"===m.call(t)}function l(t){return"[object Blob]"===m.call(t)}function p(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function h(t,n){if(null!==t&&"undefined"!=typeof t){var r=e(t)||"object"==typeof t&&!isNaN(t.length);if("object"==typeof t||r||(t=[t]),r)for(var o=0,i=t.length;i>o;o++)n.call(null,t[o],o,t);else for(var s in t)t.hasOwnProperty(s)&&n.call(null,t[s],s,t)}}function d(){var t={};return h(arguments,function(e){h(e,function(e,n){t[n]=e})}),t}var m=Object.prototype.toString;t.exports={isArray:e,isArrayBuffer:n,isFormData:r,isArrayBufferView:o,isString:i,isNumber:s,isObject:a,isUndefined:u,isDate:c,isFile:f,isBlob:l,forEach:h,merge:d,trim:p}},function(t){"use strict";t.exports=function(t,e,n){try{console.warn("DEPRECATED method `"+t+"`."+(e?" Use `"+e+"` instead.":"")+" This method will be removed in a future release."),n&&console.warn("For more information about usage see "+n)}catch(r){}}},function(t,e,n){(function(e){"use strict";t.exports=function(t){return new Promise(function(r,o){try{"undefined"!=typeof window?n(8)(r,o,t):"undefined"!=typeof e&&n(8)(r,o,t)}catch(i){o(i)}})}}).call(e,n(10))},function(t,e,n){"use strict";function r(){this.handlers=[]}var o=n(3);r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=r},function(t){t.exports=function(t){return function(e){t.apply(null,e)}}},function(t,e,n){var r=n(2),o=n(3),i=n(11),s=n(12),u=n(13),a=n(14),c=n(15);t.exports=function(t,e,n){var f=a(n.data,n.headers,n.transformRequest),l=o.merge(r.headers.common,r.headers[n.method]||{},n.headers||{});o.isFormData(f)&&delete l["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method.toUpperCase(),i(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=u(p.getAllResponseHeaders()),o=-1!==["text",""].indexOf(n.responseType||"")?p.responseText:p.response,i={data:a(o,r,n.transformResponse),status:p.status,statusText:p.statusText,headers:r,config:n};(p.status>=200&&p.status<300?t:e)(i),p=null}};var h=c(n.url)?s.read(n.xsrfCookieName||r.xsrfCookieName):void 0;if(h&&(l[n.xsrfHeaderName||r.xsrfHeaderName]=h),o.forEach(l,function(t,e){f||"content-type"!==e.toLowerCase()?p.setRequestHeader(e,t):delete l[e]}),n.withCredentials&&(p.withCredentials=!0),n.responseType)try{p.responseType=n.responseType}catch(d){if("json"!==p.responseType)throw d}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(t,e,n){var r;(function(t,o,i){/*! | ||
/* axios v0.5.3 | (c) 2015 by Matt Zabriskie */ | ||
var axios=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";var r=n(2),o=n(3),i=n(4),s=n(5),u=n(6);!function(){var t=n(9);t&&"function"==typeof t.polyfill&&t.polyfill()}();var c=t.exports=function a(t){t=o.merge({method:"get",headers:{},transformRequest:r.transformRequest,transformResponse:r.transformResponse},t),t.withCredentials=t.withCredentials||r.withCredentials;var e=[s,void 0],n=Promise.resolve(t);for(a.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),a.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n.success=function(t){return i("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(function(e){t(e.data,e.status,e.headers,e.config)}),n},n.error=function(t){return i("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(null,function(e){t(e.data,e.status,e.headers,e.config)}),n},n};c.defaults=r,c.all=function(t){return Promise.all(t)},c.spread=n(7),c.interceptors={request:new u,response:new u},function(){function t(){o.forEach(arguments,function(t){c[t]=function(e,n){return c(o.merge(n||{},{method:t,url:e}))}})}function e(){o.forEach(arguments,function(t){c[t]=function(e,n,r){return c(o.merge(r||{},{method:t,url:e,data:n}))}})}t("delete","get","head"),e("post","put","patch")}()},function(t,e,n){"use strict";var r=n(3),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,e){return r.isArrayBuffer(t)?t:r.isArrayBufferView(t)?t.buffer:!r.isObject(t)||r.isFile(t)||r.isBlob(t)?t:(!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]="application/json;charset=utf-8"),JSON.stringify(t))}],transformResponse:[function(t){if("string"==typeof t){t=t.replace(o,"");try{t=JSON.parse(t)}catch(e){}}return t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(i),post:r.merge(i),put:r.merge(i)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t){"use strict";function e(t){return"[object Array]"===m.call(t)}function n(t){return"[object ArrayBuffer]"===m.call(t)}function r(t){return"[object FormData]"===m.call(t)}function o(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function i(t){return"string"==typeof t}function s(t){return"number"==typeof t}function u(t){return"undefined"==typeof t}function c(t){return null!==t&&"object"==typeof t}function a(t){return"[object Date]"===m.call(t)}function f(t){return"[object File]"===m.call(t)}function l(t){return"[object Blob]"===m.call(t)}function p(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function h(t,n){if(null!==t&&"undefined"!=typeof t){var r=e(t)||"object"==typeof t&&!isNaN(t.length);if("object"==typeof t||r||(t=[t]),r)for(var o=0,i=t.length;i>o;o++)n.call(null,t[o],o,t);else for(var s in t)t.hasOwnProperty(s)&&n.call(null,t[s],s,t)}}function d(){var t={};return h(arguments,function(e){h(e,function(e,n){t[n]=e})}),t}var m=Object.prototype.toString;t.exports={isArray:e,isArrayBuffer:n,isFormData:r,isArrayBufferView:o,isString:i,isNumber:s,isObject:c,isUndefined:u,isDate:a,isFile:f,isBlob:l,forEach:h,merge:d,trim:p}},function(t){"use strict";t.exports=function(t,e,n){try{console.warn("DEPRECATED method `"+t+"`."+(e?" Use `"+e+"` instead.":"")+" This method will be removed in a future release."),n&&console.warn("For more information about usage see "+n)}catch(r){}}},function(t,e,n){(function(e){"use strict";t.exports=function(t){return new Promise(function(r,o){try{"undefined"!=typeof window?n(8)(r,o,t):"undefined"!=typeof e&&n(8)(r,o,t)}catch(i){o(i)}})}}).call(e,n(10))},function(t,e,n){"use strict";function r(){this.handlers=[]}var o=n(3);r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=r},function(t){"use strict";t.exports=function(t){return function(e){t.apply(null,e)}}},function(t,e,n){"use strict";var r=n(2),o=n(3),i=n(11),s=n(12),u=n(13),c=n(14),a=n(15);t.exports=function(t,e,n){var f=c(n.data,n.headers,n.transformRequest),l=o.merge(r.headers.common,r.headers[n.method]||{},n.headers||{});o.isFormData(f)&&delete l["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method.toUpperCase(),i(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=u(p.getAllResponseHeaders()),o=-1!==["text",""].indexOf(n.responseType||"")?p.responseText:p.response,i={data:c(o,r,n.transformResponse),status:p.status,statusText:p.statusText,headers:r,config:n};(p.status>=200&&p.status<300?t:e)(i),p=null}};var h=a(n.url)?s.read(n.xsrfCookieName||r.xsrfCookieName):void 0;if(h&&(l[n.xsrfHeaderName||r.xsrfHeaderName]=h),o.forEach(l,function(t,e){f||"content-type"!==e.toLowerCase()?p.setRequestHeader(e,t):delete l[e]}),n.withCredentials&&(p.withCredentials=!0),n.responseType)try{p.responseType=n.responseType}catch(d){if("json"!==p.responseType)throw d}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(t,e,n){var r;(function(t,o,i){/*! | ||
* @overview es6-promise - a tiny implementation of Promises/A+. | ||
@@ -9,3 +9,3 @@ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) | ||
*/ | ||
(function(){"use strict";function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function u(t){return"function"==typeof t}function a(t){return"object"==typeof t&&null!==t}function c(){}function f(){return function(){t.nextTick(d)}}function l(){var t=0,e=new X(d),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function p(){var t=new MessageChannel;return t.port1.onmessage=d,function(){t.port2.postMessage(0)}}function h(){return function(){setTimeout(d,1)}}function d(){for(var t=0;H>t;t+=2){var e=$[t],n=$[t+1];e(n),$[t]=void 0,$[t+1]=void 0}H=0}function m(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function v(){return new TypeError("A promises callback cannot return that same promise.")}function w(t){try{return t.then}catch(e){return z.error=e,z}}function g(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function b(t,e,n){L(function(t){var r=!1,o=g(n,e,function(n){r||(r=!0,e!==n?A(t,n):j(t,n))},function(e){r||(r=!0,T(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,T(t,o))},t)}function _(t,e){e._state===K?j(t,e._result):t._state===Y?T(t,e._result):C(e,void 0,function(e){A(t,e)},function(e){T(t,e)})}function x(t,e){if(e.constructor===t.constructor)_(t,e);else{var n=w(e);n===z?T(t,z.error):void 0===n?j(t,e):u(n)?b(t,e,n):j(t,e)}}function A(t,e){t===e?T(t,y()):s(e)?x(t,e):j(t,e)}function E(t){t._onerror&&t._onerror(t._result),R(t)}function j(t,e){t._state===J&&(t._result=e,t._state=K,0===t._subscribers.length||L(R,t))}function T(t,e){t._state===J&&(t._state=Y,t._result=e,L(E,t))}function C(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+K]=n,o[i+Y]=r,0===i&&t._state&&L(R,t)}function R(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?P(n,r,o,i):o(i);t._subscribers.length=0}}function S(){this.error=null}function O(t,e){try{return t(e)}catch(n){return G.error=n,G}}function P(t,e,n,r){var o,i,s,a,c=u(n);if(c){if(o=O(n,r),o===G?(a=!0,i=o.error,o=null):s=!0,e===o)return void T(e,v())}else o=r,s=!0;e._state!==J||(c&&s?A(e,o):a?T(e,i):t===K?j(e,o):t===Y&&T(e,o))}function k(t,e){try{e(function(e){A(t,e)},function(e){T(t,e)})}catch(n){T(t,n)}}function D(t,e,n,r){this._instanceConstructor=t,this.promise=new t(m,r),this._abortOnReject=n,this._validateInput(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._init(),0===this.length?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&j(this.promise,this._result))):T(this.promise,this._validationError())}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function M(t){this._id=ne++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&(u(t)||N(),this instanceof M||B(),k(this,t))}var F;F=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var U,q=F,H=(Date.now||function(){return(new Date).getTime()},Object.create||function(t){if(arguments.length>1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return c.prototype=t,new c},0),L=function(t,e){$[H]=t,$[H+1]=e,H+=2,2===H&&U()},I="undefined"!=typeof window?window:{},X=I.MutationObserver||I.WebKitMutationObserver,V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3);U="undefined"!=typeof t&&"[object process]"==={}.toString.call(t)?f():X?l():V?p():h();var J=void 0,K=1,Y=2,z=new S,G=new S;D.prototype._validateInput=function(t){return q(t)},D.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},D.prototype._init=function(){this._result=new Array(this.length)};var W=D;D.prototype._enumerate=function(){for(var t=this.length,e=this.promise,n=this._input,r=0;e._state===J&&t>r;r++)this._eachEntry(n[r],r)},D.prototype._eachEntry=function(t,e){var n=this._instanceConstructor;a(t)?t.constructor===n&&t._state!==J?(t._onerror=null,this._settledAt(t._state,e,t._result)):this._willSettleAt(n.resolve(t),e):(this._remaining--,this._result[e]=this._makeResult(K,e,t))},D.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===J&&(this._remaining--,this._abortOnReject&&t===Y?T(r,n):this._result[e]=this._makeResult(t,e,n)),0===this._remaining&&j(r,this._result)},D.prototype._makeResult=function(t,e,n){return n},D.prototype._willSettleAt=function(t,e){var n=this;C(t,void 0,function(t){n._settledAt(K,e,t)},function(t){n._settledAt(Y,e,t)})};var Q=function(t,e){return new W(this,t,!0,e).promise},Z=function(t,e){function n(t){A(i,t)}function r(t){T(i,t)}var o=this,i=new o(m,e);if(!q(t))return T(i,new TypeError("You must pass an array to race.")),i;for(var s=t.length,u=0;i._state===J&&s>u;u++)C(o.resolve(t[u]),void 0,n,r);return i},te=function(t,e){var n=this;if(t&&"object"==typeof t&&t.constructor===n)return t;var r=new n(m,e);return A(r,t),r},ee=function(t,e){var n=this,r=new n(m,e);return T(r,t),r},ne=0,re=M;M.all=Q,M.race=Z,M.resolve=te,M.reject=ee,M.prototype={constructor:M,then:function(t,e){var n=this,r=n._state;if(r===K&&!t||r===Y&&!e)return this;var o=new this.constructor(m),i=n._result;if(r){var s=arguments[r-1];L(function(){P(r,o,s,i)})}else C(n,o,t,e);return o},"catch":function(t){return this.then(null,t)}};var oe=function(){var t;t="undefined"!=typeof o?o:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),u(e)}();e||(t.Promise=re)},ie={Promise:re,polyfill:oe};n(16).amd?(r=function(){return ie}.call(e,n,e,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=ie:"undefined"!=typeof this&&(this.ES6Promise=ie)}).call(this)}).call(e,n(10),function(){return this}(),n(17)(t))},function(t){function e(){if(!i){i=!0;for(var t,e=o.length;e;){t=o,o=[];for(var n=-1;++n<e;)t[n]();e=o.length}i=!1}}function n(){}var r=t.exports={},o=[],i=!1;r.nextTick=function(t){o.push(t),i||setTimeout(e,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}var o=n(3);t.exports=function(t,e){if(!e)return t;var n=[];return o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),n.push(r(e)+"="+r(t))}))}),n.length>0&&(t+=(-1===t.indexOf("?")?"?":"&")+n.join("&")),t}},function(t,e,n){"use strict";var r=n(3);t.exports={write:function(t,e,n,o,i,s){var u=[];u.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t){var e,n,o,i={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e&&(i[e]=i[e]?i[e]+", "+n:n)}),i):i}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";function r(t){var e=t;return o&&(s.setAttribute("href",e),e=s.href),s.setAttribute("href",e),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:"/"===s.pathname.charAt(0)?s.pathname:"/"+s.pathname}}var o=/(msie|trident)/i.test(navigator.userAgent),i=n(3),s=document.createElement("a"),u=r(window.location.href);t.exports=function(t){var e=i.isString(t)?r(t):t;return e.protocol===u.protocol&&e.host===u.host}},function(t){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}}]); | ||
(function(){"use strict";function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function u(t){return"function"==typeof t}function c(t){return"object"==typeof t&&null!==t}function a(){}function f(){return function(){t.nextTick(d)}}function l(){var t=0,e=new X(d),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function p(){var t=new MessageChannel;return t.port1.onmessage=d,function(){t.port2.postMessage(0)}}function h(){return function(){setTimeout(d,1)}}function d(){for(var t=0;H>t;t+=2){var e=J[t],n=J[t+1];e(n),J[t]=void 0,J[t+1]=void 0}H=0}function m(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function v(){return new TypeError("A promises callback cannot return that same promise.")}function w(t){try{return t.then}catch(e){return z.error=e,z}}function g(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function b(t,e,n){L(function(t){var r=!1,o=g(n,e,function(n){r||(r=!0,e!==n?A(t,n):j(t,n))},function(e){r||(r=!0,T(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,T(t,o))},t)}function _(t,e){e._state===Y?j(t,e._result):t._state===$?T(t,e._result):C(e,void 0,function(e){A(t,e)},function(e){T(t,e)})}function x(t,e){if(e.constructor===t.constructor)_(t,e);else{var n=w(e);n===z?T(t,z.error):void 0===n?j(t,e):u(n)?b(t,e,n):j(t,e)}}function A(t,e){t===e?T(t,y()):s(e)?x(t,e):j(t,e)}function E(t){t._onerror&&t._onerror(t._result),R(t)}function j(t,e){t._state===K&&(t._result=e,t._state=Y,0===t._subscribers.length||L(R,t))}function T(t,e){t._state===K&&(t._state=$,t._result=e,L(E,t))}function C(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+Y]=n,o[i+$]=r,0===i&&t._state&&L(R,t)}function R(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?P(n,r,o,i):o(i);t._subscribers.length=0}}function S(){this.error=null}function O(t,e){try{return t(e)}catch(n){return G.error=n,G}}function P(t,e,n,r){var o,i,s,c,a=u(n);if(a){if(o=O(n,r),o===G?(c=!0,i=o.error,o=null):s=!0,e===o)return void T(e,v())}else o=r,s=!0;e._state!==K||(a&&s?A(e,o):c?T(e,i):t===Y?j(e,o):t===$&&T(e,o))}function k(t,e){try{e(function(e){A(t,e)},function(e){T(t,e)})}catch(n){T(t,n)}}function D(t,e,n,r){this._instanceConstructor=t,this.promise=new t(m,r),this._abortOnReject=n,this._validateInput(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._init(),0===this.length?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&j(this.promise,this._result))):T(this.promise,this._validationError())}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function M(t){this._id=ne++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&(u(t)||N(),this instanceof M||B(),k(this,t))}var F;F=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var U,q=F,H=(Date.now||function(){return(new Date).getTime()},Object.create||function(t){if(arguments.length>1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return a.prototype=t,new a},0),L=function(t,e){J[H]=t,J[H+1]=e,H+=2,2===H&&U()},I="undefined"!=typeof window?window:{},X=I.MutationObserver||I.WebKitMutationObserver,V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,J=new Array(1e3);U="undefined"!=typeof t&&"[object process]"==={}.toString.call(t)?f():X?l():V?p():h();var K=void 0,Y=1,$=2,z=new S,G=new S;D.prototype._validateInput=function(t){return q(t)},D.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},D.prototype._init=function(){this._result=new Array(this.length)};var W=D;D.prototype._enumerate=function(){for(var t=this.length,e=this.promise,n=this._input,r=0;e._state===K&&t>r;r++)this._eachEntry(n[r],r)},D.prototype._eachEntry=function(t,e){var n=this._instanceConstructor;c(t)?t.constructor===n&&t._state!==K?(t._onerror=null,this._settledAt(t._state,e,t._result)):this._willSettleAt(n.resolve(t),e):(this._remaining--,this._result[e]=this._makeResult(Y,e,t))},D.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===K&&(this._remaining--,this._abortOnReject&&t===$?T(r,n):this._result[e]=this._makeResult(t,e,n)),0===this._remaining&&j(r,this._result)},D.prototype._makeResult=function(t,e,n){return n},D.prototype._willSettleAt=function(t,e){var n=this;C(t,void 0,function(t){n._settledAt(Y,e,t)},function(t){n._settledAt($,e,t)})};var Q=function(t,e){return new W(this,t,!0,e).promise},Z=function(t,e){function n(t){A(i,t)}function r(t){T(i,t)}var o=this,i=new o(m,e);if(!q(t))return T(i,new TypeError("You must pass an array to race.")),i;for(var s=t.length,u=0;i._state===K&&s>u;u++)C(o.resolve(t[u]),void 0,n,r);return i},te=function(t,e){var n=this;if(t&&"object"==typeof t&&t.constructor===n)return t;var r=new n(m,e);return A(r,t),r},ee=function(t,e){var n=this,r=new n(m,e);return T(r,t),r},ne=0,re=M;M.all=Q,M.race=Z,M.resolve=te,M.reject=ee,M.prototype={constructor:M,then:function(t,e){var n=this,r=n._state;if(r===Y&&!t||r===$&&!e)return this;var o=new this.constructor(m),i=n._result;if(r){var s=arguments[r-1];L(function(){P(r,o,s,i)})}else C(n,o,t,e);return o},"catch":function(t){return this.then(null,t)}};var oe=function(){var t;t="undefined"!=typeof o?o:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),u(e)}();e||(t.Promise=re)},ie={Promise:re,polyfill:oe};n(16).amd?(r=function(){return ie}.call(e,n,e,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=ie:"undefined"!=typeof this&&(this.ES6Promise=ie)}).call(this)}).call(e,n(10),function(){return this}(),n(17)(t))},function(t){function e(){if(!i){i=!0;for(var t,e=o.length;e;){t=o,o=[];for(var n=-1;++n<e;)t[n]();e=o.length}i=!1}}function n(){}var r=t.exports={},o=[],i=!1;r.nextTick=function(t){o.push(t),i||setTimeout(e,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}var o=n(3);t.exports=function(t,e){if(!e)return t;var n=[];return o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),n.push(r(e)+"="+r(t))}))}),n.length>0&&(t+=(-1===t.indexOf("?")?"?":"&")+n.join("&")),t}},function(t,e,n){"use strict";var r=n(3);t.exports={write:function(t,e,n,o,i,s){var u=[];u.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t){var e,n,o,i={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e&&(i[e]=i[e]?i[e]+", "+n:n)}),i):i}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";function r(t){var e=t;return s&&(u.setAttribute("href",e),e=u.href),u.setAttribute("href",e),{href:u.href,protocol:u.protocol?u.protocol.replace(/:$/,""):"",host:u.host,search:u.search?u.search.replace(/^\?/,""):"",hash:u.hash?u.hash.replace(/^#/,""):"",hostname:u.hostname,port:u.port,pathname:"/"===u.pathname.charAt(0)?u.pathname:"/"+u.pathname}}var o,i=n(3),s=/(msie|trident)/i.test(navigator.userAgent),u=document.createElement("a");o=r(window.location.href),t.exports=function(t){var e=i.isString(t)?r(t):t;return e.protocol===o.protocol&&e.host===o.host}},function(t){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}}]); | ||
//# sourceMappingURL=axios.min.map |
@@ -54,2 +54,4 @@ var axios = | ||
'use strict'; | ||
var defaults = __webpack_require__(3); | ||
@@ -137,28 +139,29 @@ var utils = __webpack_require__(4); | ||
// Provide aliases for supported request methods | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
(function () { | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
})(); | ||
@@ -180,4 +183,2 @@ | ||
var JSON_START = /^\s*(\[|\{[^\{])/; | ||
var JSON_END = /[\}\]]\s*$/; | ||
var PROTECTION_PREFIX = /^\)\]\}',?\n/; | ||
@@ -209,5 +210,5 @@ var DEFAULT_CONTENT_TYPE = { | ||
data = data.replace(PROTECTION_PREFIX, ''); | ||
if (JSON_START.test(data) && JSON_END.test(data)) { | ||
try { | ||
data = JSON.parse(data); | ||
} | ||
} catch (e) {} | ||
} | ||
@@ -230,2 +231,3 @@ return data; | ||
/***/ }, | ||
@@ -235,2 +237,6 @@ /* 4 */ | ||
'use strict'; | ||
/*global toString:true*/ | ||
// utils is a library of generic helper functions non-specific to axios | ||
@@ -392,3 +398,3 @@ | ||
if (isArrayLike) { | ||
for (var i=0, l=obj.length; i<l; i++) { | ||
for (var i = 0, l = obj.length; i < l; i++) { | ||
fn.call(null, obj[i], i, obj); | ||
@@ -424,3 +430,3 @@ } | ||
*/ | ||
function merge(obj1/*, obj2, obj3, ...*/) { | ||
function merge(/*obj1, obj2, obj3, ...*/) { | ||
var result = {}; | ||
@@ -524,3 +530,3 @@ forEach(arguments, function (obj) { | ||
this.handlers = []; | ||
}; | ||
} | ||
@@ -566,3 +572,3 @@ /** | ||
fn(h); | ||
} | ||
} | ||
}); | ||
@@ -572,3 +578,2 @@ }; | ||
module.exports = InterceptorManager; | ||
@@ -580,2 +585,4 @@ | ||
'use strict'; | ||
/** | ||
@@ -607,2 +614,3 @@ * Syntactic sugar for invoking a function and expanding an array for arguments. | ||
/***/ }, | ||
@@ -612,2 +620,6 @@ /* 9 */ | ||
'use strict'; | ||
/*global ActiveXObject:true*/ | ||
var defaults = __webpack_require__(3); | ||
@@ -630,3 +642,3 @@ var utils = __webpack_require__(4); | ||
// Merge headers | ||
var headers = utils.merge( | ||
var requestHeaders = utils.merge( | ||
defaults.headers.common, | ||
@@ -638,7 +650,7 @@ defaults.headers[config.method] || {}, | ||
if (utils.isFormData(data)) { | ||
delete headers['Content-Type']; // Let the browser set it | ||
delete requestHeaders['Content-Type']; // Let the browser set it | ||
} | ||
// Create the request | ||
var request = new(XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
var request = new (XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
request.open(config.method.toUpperCase(), buildUrl(config.url, config.params), true); | ||
@@ -650,3 +662,3 @@ | ||
// Prepare the response | ||
var headers = parseHeaders(request.getAllResponseHeaders()); | ||
var responseHeaders = parseHeaders(request.getAllResponseHeaders()); | ||
var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response; | ||
@@ -656,3 +668,3 @@ var response = { | ||
responseData, | ||
headers, | ||
responseHeaders, | ||
config.transformResponse | ||
@@ -662,3 +674,3 @@ ), | ||
statusText: request.statusText, | ||
headers: headers, | ||
headers: responseHeaders, | ||
config: config | ||
@@ -668,5 +680,5 @@ }; | ||
// Resolve or reject the Promise based on the status | ||
(request.status >= 200 && request.status < 300 | ||
? resolve | ||
: reject)(response); | ||
(request.status >= 200 && request.status < 300 ? | ||
resolve : | ||
reject)(response); | ||
@@ -679,14 +691,14 @@ // Clean up request | ||
// Add xsrf header | ||
var xsrfValue = urlIsSameOrigin(config.url) | ||
? cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) | ||
: undefined; | ||
var xsrfValue = urlIsSameOrigin(config.url) ? | ||
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) : | ||
undefined; | ||
if (xsrfValue) { | ||
headers[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
requestHeaders[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
} | ||
// Add headers to the request | ||
utils.forEach(headers, function (val, key) { | ||
utils.forEach(requestHeaders, function (val, key) { | ||
// Remove Content-Type if data is undefined | ||
if (!data && key.toLowerCase() === 'content-type') { | ||
delete headers[key]; | ||
delete requestHeaders[key]; | ||
} | ||
@@ -888,2 +900,3 @@ // Otherwise add header to the request | ||
/***/ }, | ||
@@ -913,3 +926,3 @@ /* 13 */ | ||
if (!headers) return parsed; | ||
if (!headers) { return parsed; } | ||
@@ -929,2 +942,3 @@ utils.forEach(headers.split('\n'), function(line) { | ||
/***/ }, | ||
@@ -954,2 +968,3 @@ /* 14 */ | ||
/***/ }, | ||
@@ -961,6 +976,6 @@ /* 15 */ | ||
var utils = __webpack_require__(4); | ||
var msie = /(msie|trident)/i.test(navigator.userAgent); | ||
var utils = __webpack_require__(4); | ||
var urlParsingNode = document.createElement('a'); | ||
var originUrl = urlResolve(window.location.href); | ||
var originUrl; | ||
@@ -993,8 +1008,10 @@ /** | ||
port: urlParsingNode.port, | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') | ||
? urlParsingNode.pathname | ||
: '/' + urlParsingNode.pathname | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') ? | ||
urlParsingNode.pathname : | ||
'/' + urlParsingNode.pathname | ||
}; | ||
} | ||
originUrl = urlResolve(window.location.href); | ||
/** | ||
@@ -1012,4 +1029,5 @@ * Determine if a URL shares the same origin as the current location | ||
/***/ } | ||
/******/ ]); | ||
//# sourceMappingURL=axios.standalone.map |
@@ -1,3 +0,3 @@ | ||
/* axios v0.5.2 | (c) 2015 by Matt Zabriskie */ | ||
var axios=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){function r(){s.forEach(arguments,function(e){f[e]=function(t,n){return f(s.merge(n||{},{method:e,url:t}))}})}function o(){s.forEach(arguments,function(e){f[e]=function(t,n,r){return f(s.merge(r||{},{method:e,url:t,data:n}))}})}var i=n(3),s=n(4),u=n(5),a=n(6),c=n(7);!function(){var e=n(2);e&&"function"==typeof e.polyfill&&e.polyfill()}();var f=e.exports=function l(e){e=s.merge({method:"get",headers:{},transformRequest:i.transformRequest,transformResponse:i.transformResponse},e),e.withCredentials=e.withCredentials||i.withCredentials;var t=[a,void 0],n=Promise.resolve(e);for(l.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),l.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n.success=function(e){return u("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(function(t){e(t.data,t.status,t.headers,t.config)}),n},n.error=function(e){return u("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),n.then(null,function(t){e(t.data,t.status,t.headers,t.config)}),n},n};f.defaults=i,f.all=function(e){return Promise.all(e)},f.spread=n(8),f.interceptors={request:new c,response:new c},r("delete","get","head"),o("post","put","patch")},function(e){e.exports={Promise:Promise}},function(e,t,n){"use strict";var r=n(4),o=/^\s*(\[|\{[^\{])/,i=/[\}\]]\s*$/,s=/^\)\]\}',?\n/,u={"Content-Type":"application/x-www-form-urlencoded"};e.exports={transformRequest:[function(e,t){return r.isArrayBuffer(e)?e:r.isArrayBufferView(e)?e.buffer:!r.isObject(e)||r.isFile(e)||r.isBlob(e)?e:(!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]="application/json;charset=utf-8"),JSON.stringify(e))}],transformResponse:[function(e){return"string"==typeof e&&(e=e.replace(s,""),o.test(e)&&i.test(e)&&(e=JSON.parse(e))),e}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(u),post:r.merge(u),put:r.merge(u)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(e){function t(e){return"[object Array]"===m.call(e)}function n(e){return"[object ArrayBuffer]"===m.call(e)}function r(e){return"[object FormData]"===m.call(e)}function o(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function i(e){return"string"==typeof e}function s(e){return"number"==typeof e}function u(e){return"undefined"==typeof e}function a(e){return null!==e&&"object"==typeof e}function c(e){return"[object Date]"===m.call(e)}function f(e){return"[object File]"===m.call(e)}function l(e){return"[object Blob]"===m.call(e)}function p(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function h(e,n){if(null!==e&&"undefined"!=typeof e){var r=t(e)||"object"==typeof e&&!isNaN(e.length);if("object"==typeof e||r||(e=[e]),r)for(var o=0,i=e.length;i>o;o++)n.call(null,e[o],o,e);else for(var s in e)e.hasOwnProperty(s)&&n.call(null,e[s],s,e)}}function d(){var e={};return h(arguments,function(t){h(t,function(t,n){e[n]=t})}),e}var m=Object.prototype.toString;e.exports={isArray:t,isArrayBuffer:n,isFormData:r,isArrayBufferView:o,isString:i,isNumber:s,isObject:a,isUndefined:u,isDate:c,isFile:f,isBlob:l,forEach:h,merge:d,trim:p}},function(e){"use strict";e.exports=function(e,t,n){try{console.warn("DEPRECATED method `"+e+"`."+(t?" Use `"+t+"` instead.":"")+" This method will be removed in a future release."),n&&console.warn("For more information about usage see "+n)}catch(r){}}},function(e,t,n){(function(t){"use strict";e.exports=function(e){return new Promise(function(r,o){try{"undefined"!=typeof window?n(9)(r,o,e):"undefined"!=typeof t&&n(9)(r,o,e)}catch(i){o(i)}})}}).call(t,n(10))},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(4);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e){e.exports=function(e){return function(t){e.apply(null,t)}}},function(e,t,n){var r=n(3),o=n(4),i=n(11),s=n(12),u=n(13),a=n(14),c=n(15);e.exports=function(e,t,n){var f=a(n.data,n.headers,n.transformRequest),l=o.merge(r.headers.common,r.headers[n.method]||{},n.headers||{});o.isFormData(f)&&delete l["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method.toUpperCase(),i(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=u(p.getAllResponseHeaders()),o=-1!==["text",""].indexOf(n.responseType||"")?p.responseText:p.response,i={data:a(o,r,n.transformResponse),status:p.status,statusText:p.statusText,headers:r,config:n};(p.status>=200&&p.status<300?e:t)(i),p=null}};var h=c(n.url)?s.read(n.xsrfCookieName||r.xsrfCookieName):void 0;if(h&&(l[n.xsrfHeaderName||r.xsrfHeaderName]=h),o.forEach(l,function(e,t){f||"content-type"!==t.toLowerCase()?p.setRequestHeader(t,e):delete l[t]}),n.withCredentials&&(p.withCredentials=!0),n.responseType)try{p.responseType=n.responseType}catch(d){if("json"!==p.responseType)throw d}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(e){function t(){if(!i){i=!0;for(var e,t=o.length;t;){e=o,o=[];for(var n=-1;++n<t;)e[n]();t=o.length}i=!1}}function n(){}var r=e.exports={},o=[],i=!1;r.nextTick=function(e){o.push(e),i||setTimeout(t,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}var o=n(4);e.exports=function(e,t){if(!t)return e;var n=[];return o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)||(e=[e]),o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),n.push(r(t)+"="+r(e))}))}),n.length>0&&(e+=(-1===e.indexOf("?")?"?":"&")+n.join("&")),e}},function(e,t,n){"use strict";var r=n(4);e.exports={write:function(e,t,n,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.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(e,t,n){"use strict";var r=n(4);e.exports=function(e){var t,n,o,i={};return e?(r.forEach(e.split("\n"),function(e){o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t&&(i[t]=i[t]?i[t]+", "+n:n)}),i):i}},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";function r(e){var t=e;return o&&(s.setAttribute("href",t),t=s.href),s.setAttribute("href",t),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:"/"===s.pathname.charAt(0)?s.pathname:"/"+s.pathname}}var o=/(msie|trident)/i.test(navigator.userAgent),i=n(4),s=document.createElement("a"),u=r(window.location.href);e.exports=function(e){var t=i.isString(e)?r(e):e;return t.protocol===u.protocol&&t.host===u.host}}]); | ||
/* axios v0.5.3 | (c) 2015 by Matt Zabriskie */ | ||
var axios=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";var n=r(3),o=r(4),i=r(5),s=r(6),u=r(7);!function(){var e=r(2);e&&"function"==typeof e.polyfill&&e.polyfill()}();var a=e.exports=function c(e){e=o.merge({method:"get",headers:{},transformRequest:n.transformRequest,transformResponse:n.transformResponse},e),e.withCredentials=e.withCredentials||n.withCredentials;var t=[s,void 0],r=Promise.resolve(e);for(c.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),c.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)r=r.then(t.shift(),t.shift());return r.success=function(e){return i("success","then","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),r.then(function(t){e(t.data,t.status,t.headers,t.config)}),r},r.error=function(e){return i("error","catch","https://github.com/mzabriskie/axios/blob/master/README.md#response-api"),r.then(null,function(t){e(t.data,t.status,t.headers,t.config)}),r},r};a.defaults=n,a.all=function(e){return Promise.all(e)},a.spread=r(8),a.interceptors={request:new u,response:new u},function(){function e(){o.forEach(arguments,function(e){a[e]=function(t,r){return a(o.merge(r||{},{method:e,url:t}))}})}function t(){o.forEach(arguments,function(e){a[e]=function(t,r,n){return a(o.merge(n||{},{method:e,url:t,data:r}))}})}e("delete","get","head"),t("post","put","patch")}()},function(e){e.exports={Promise:Promise}},function(e,t,r){"use strict";var n=r(4),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};e.exports={transformRequest:[function(e,t){return n.isArrayBuffer(e)?e:n.isArrayBufferView(e)?e.buffer:!n.isObject(e)||n.isFile(e)||n.isBlob(e)?e:(!n.isUndefined(t)&&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)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(e){"use strict";function t(e){return"[object Array]"===m.call(e)}function r(e){return"[object ArrayBuffer]"===m.call(e)}function n(e){return"[object FormData]"===m.call(e)}function o(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function i(e){return"string"==typeof e}function s(e){return"number"==typeof e}function u(e){return"undefined"==typeof e}function a(e){return null!==e&&"object"==typeof e}function c(e){return"[object Date]"===m.call(e)}function f(e){return"[object File]"===m.call(e)}function l(e){return"[object Blob]"===m.call(e)}function p(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function h(e,r){if(null!==e&&"undefined"!=typeof e){var n=t(e)||"object"==typeof e&&!isNaN(e.length);if("object"==typeof e||n||(e=[e]),n)for(var o=0,i=e.length;i>o;o++)r.call(null,e[o],o,e);else for(var s in e)e.hasOwnProperty(s)&&r.call(null,e[s],s,e)}}function d(){var e={};return h(arguments,function(t){h(t,function(t,r){e[r]=t})}),e}var m=Object.prototype.toString;e.exports={isArray:t,isArrayBuffer:r,isFormData:n,isArrayBufferView:o,isString:i,isNumber:s,isObject:a,isUndefined:u,isDate:c,isFile:f,isBlob:l,forEach:h,merge:d,trim:p}},function(e){"use strict";e.exports=function(e,t,r){try{console.warn("DEPRECATED method `"+e+"`."+(t?" Use `"+t+"` instead.":"")+" This method will be removed in a future release."),r&&console.warn("For more information about usage see "+r)}catch(n){}}},function(e,t,r){(function(t){"use strict";e.exports=function(e){return new Promise(function(n,o){try{"undefined"!=typeof window?r(9)(n,o,e):"undefined"!=typeof t&&r(9)(n,o,e)}catch(i){o(i)}})}}).call(t,r(10))},function(e,t,r){"use strict";function n(){this.handlers=[]}var o=r(4);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){"use strict";e.exports=function(e){return function(t){e.apply(null,t)}}},function(e,t,r){"use strict";var n=r(3),o=r(4),i=r(11),s=r(12),u=r(13),a=r(14),c=r(15);e.exports=function(e,t,r){var f=a(r.data,r.headers,r.transformRequest),l=o.merge(n.headers.common,n.headers[r.method]||{},r.headers||{});o.isFormData(f)&&delete l["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(r.method.toUpperCase(),i(r.url,r.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var n=u(p.getAllResponseHeaders()),o=-1!==["text",""].indexOf(r.responseType||"")?p.responseText:p.response,i={data:a(o,n,r.transformResponse),status:p.status,statusText:p.statusText,headers:n,config:r};(p.status>=200&&p.status<300?e:t)(i),p=null}};var h=c(r.url)?s.read(r.xsrfCookieName||n.xsrfCookieName):void 0;if(h&&(l[r.xsrfHeaderName||n.xsrfHeaderName]=h),o.forEach(l,function(e,t){f||"content-type"!==t.toLowerCase()?p.setRequestHeader(t,e):delete l[t]}),r.withCredentials&&(p.withCredentials=!0),r.responseType)try{p.responseType=r.responseType}catch(d){if("json"!==p.responseType)throw d}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(e){function t(){if(!i){i=!0;for(var e,t=o.length;t;){e=o,o=[];for(var r=-1;++r<t;)e[r]();t=o.length}i=!1}}function r(){}var n=e.exports={},o=[],i=!1;n.nextTick=function(e){o.push(e),i||setTimeout(t,0)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=r,n.addListener=r,n.once=r,n.off=r,n.removeListener=r,n.removeAllListeners=r,n.emit=r,n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},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,"+")}var o=r(4);e.exports=function(e,t){if(!t)return e;var r=[];return o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)||(e=[e]),o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),r.push(n(t)+"="+n(e))}))}),r.length>0&&(e+=(-1===e.indexOf("?")?"?":"&")+r.join("&")),e}},function(e,t,r){"use strict";var n=r(4);e.exports={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(e,t,r){"use strict";var n=r(4);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(4);e.exports=function(e,t,r){return n.forEach(r,function(r){e=r(e,t)}),e}},function(e,t,r){"use strict";function n(e){var t=e;return s&&(u.setAttribute("href",t),t=u.href),u.setAttribute("href",t),{href:u.href,protocol:u.protocol?u.protocol.replace(/:$/,""):"",host:u.host,search:u.search?u.search.replace(/^\?/,""):"",hash:u.hash?u.hash.replace(/^#/,""):"",hostname:u.hostname,port:u.port,pathname:"/"===u.pathname.charAt(0)?u.pathname:"/"+u.pathname}}var o,i=r(4),s=/(msie|trident)/i.test(navigator.userAgent),u=document.createElement("a");o=n(window.location.href),e.exports=function(e){var t=i.isString(e)?n(e):e;return t.protocol===o.protocol&&t.host===o.host}}]); | ||
//# sourceMappingURL=axios.standalone.min.map |
@@ -0,1 +1,3 @@ | ||
'use strict'; | ||
var defaults = require('./../defaults'); | ||
@@ -74,5 +76,5 @@ var utils = require('./../utils'); | ||
// Resolve or reject the Promise based on the status | ||
(res.statusCode >= 200 && res.statusCode < 300 | ||
? resolve | ||
: reject)(response); | ||
(res.statusCode >= 200 && res.statusCode < 300 ? | ||
resolve : | ||
reject)(response); | ||
}); | ||
@@ -79,0 +81,0 @@ }); |
@@ -0,1 +1,5 @@ | ||
'use strict'; | ||
/*global ActiveXObject:true*/ | ||
var defaults = require('./../defaults'); | ||
@@ -18,3 +22,3 @@ var utils = require('./../utils'); | ||
// Merge headers | ||
var headers = utils.merge( | ||
var requestHeaders = utils.merge( | ||
defaults.headers.common, | ||
@@ -26,7 +30,7 @@ defaults.headers[config.method] || {}, | ||
if (utils.isFormData(data)) { | ||
delete headers['Content-Type']; // Let the browser set it | ||
delete requestHeaders['Content-Type']; // Let the browser set it | ||
} | ||
// Create the request | ||
var request = new(XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
var request = new (XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP'); | ||
request.open(config.method.toUpperCase(), buildUrl(config.url, config.params), true); | ||
@@ -38,3 +42,3 @@ | ||
// Prepare the response | ||
var headers = parseHeaders(request.getAllResponseHeaders()); | ||
var responseHeaders = parseHeaders(request.getAllResponseHeaders()); | ||
var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response; | ||
@@ -44,3 +48,3 @@ var response = { | ||
responseData, | ||
headers, | ||
responseHeaders, | ||
config.transformResponse | ||
@@ -50,3 +54,3 @@ ), | ||
statusText: request.statusText, | ||
headers: headers, | ||
headers: responseHeaders, | ||
config: config | ||
@@ -56,5 +60,5 @@ }; | ||
// Resolve or reject the Promise based on the status | ||
(request.status >= 200 && request.status < 300 | ||
? resolve | ||
: reject)(response); | ||
(request.status >= 200 && request.status < 300 ? | ||
resolve : | ||
reject)(response); | ||
@@ -67,14 +71,14 @@ // Clean up request | ||
// Add xsrf header | ||
var xsrfValue = urlIsSameOrigin(config.url) | ||
? cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) | ||
: undefined; | ||
var xsrfValue = urlIsSameOrigin(config.url) ? | ||
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) : | ||
undefined; | ||
if (xsrfValue) { | ||
headers[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
requestHeaders[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue; | ||
} | ||
// Add headers to the request | ||
utils.forEach(headers, function (val, key) { | ||
utils.forEach(requestHeaders, function (val, key) { | ||
// Remove Content-Type if data is undefined | ||
if (!data && key.toLowerCase() === 'content-type') { | ||
delete headers[key]; | ||
delete requestHeaders[key]; | ||
} | ||
@@ -81,0 +85,0 @@ // Otherwise add header to the request |
@@ -0,1 +1,3 @@ | ||
'use strict'; | ||
var defaults = require('./defaults'); | ||
@@ -83,27 +85,28 @@ var utils = require('./utils'); | ||
// Provide aliases for supported request methods | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
(function () { | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethods() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
function createShortMethodsWithData() { | ||
utils.forEach(arguments, function (method) { | ||
axios[method] = function (url, data, config) { | ||
return axios(utils.merge(config || {}, { | ||
method: method, | ||
url: url, | ||
data: data | ||
})); | ||
}; | ||
}); | ||
} | ||
createShortMethods('delete', 'get', 'head'); | ||
createShortMethodsWithData('post', 'put', 'patch'); | ||
})(); |
@@ -7,3 +7,3 @@ 'use strict'; | ||
this.handlers = []; | ||
}; | ||
} | ||
@@ -49,3 +49,3 @@ /** | ||
fn(h); | ||
} | ||
} | ||
}); | ||
@@ -55,2 +55,1 @@ }; | ||
module.exports = InterceptorManager; | ||
@@ -5,4 +5,2 @@ 'use strict'; | ||
var JSON_START = /^\s*(\[|\{[^\{])/; | ||
var JSON_END = /[\}\]]\s*$/; | ||
var PROTECTION_PREFIX = /^\)\]\}',?\n/; | ||
@@ -34,5 +32,5 @@ var DEFAULT_CONTENT_TYPE = { | ||
data = data.replace(PROTECTION_PREFIX, ''); | ||
if (JSON_START.test(data) && JSON_END.test(data)) { | ||
try { | ||
data = JSON.parse(data); | ||
} | ||
} catch (e) {} | ||
} | ||
@@ -53,2 +51,2 @@ return data; | ||
xsrfHeaderName: 'X-XSRF-TOKEN' | ||
}; | ||
}; |
@@ -37,2 +37,2 @@ 'use strict'; | ||
} | ||
}; | ||
}; |
@@ -21,3 +21,3 @@ 'use strict'; | ||
if (!headers) return parsed; | ||
if (!headers) { return parsed; } | ||
@@ -35,2 +35,2 @@ utils.forEach(headers.split('\n'), function(line) { | ||
return parsed; | ||
}; | ||
}; |
@@ -0,1 +1,3 @@ | ||
'use strict'; | ||
/** | ||
@@ -25,2 +27,2 @@ * Syntactic sugar for invoking a function and expanding an array for arguments. | ||
}; | ||
}; | ||
}; |
@@ -19,2 +19,2 @@ 'use strict'; | ||
return data; | ||
}; | ||
}; |
'use strict'; | ||
var utils = require('./../utils'); | ||
var msie = /(msie|trident)/i.test(navigator.userAgent); | ||
var utils = require('./../utils'); | ||
var urlParsingNode = document.createElement('a'); | ||
var originUrl = urlResolve(window.location.href); | ||
var originUrl; | ||
@@ -34,8 +34,10 @@ /** | ||
port: urlParsingNode.port, | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') | ||
? urlParsingNode.pathname | ||
: '/' + urlParsingNode.pathname | ||
pathname: (urlParsingNode.pathname.charAt(0) === '/') ? | ||
urlParsingNode.pathname : | ||
'/' + urlParsingNode.pathname | ||
}; | ||
} | ||
originUrl = urlResolve(window.location.href); | ||
/** | ||
@@ -51,2 +53,2 @@ * Determine if a URL shares the same origin as the current location | ||
parsed.host === originUrl.host); | ||
}; | ||
}; |
@@ -0,1 +1,5 @@ | ||
'use strict'; | ||
/*global toString:true*/ | ||
// utils is a library of generic helper functions non-specific to axios | ||
@@ -157,3 +161,3 @@ | ||
if (isArrayLike) { | ||
for (var i=0, l=obj.length; i<l; i++) { | ||
for (var i = 0, l = obj.length; i < l; i++) { | ||
fn.call(null, obj[i], i, obj); | ||
@@ -189,3 +193,3 @@ } | ||
*/ | ||
function merge(obj1/*, obj2, obj3, ...*/) { | ||
function merge(/*obj1, obj2, obj3, ...*/) { | ||
var result = {}; | ||
@@ -192,0 +196,0 @@ forEach(arguments, function (obj) { |
{ | ||
"name": "axios", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "Promise based HTTP client for the browser and node.js", | ||
@@ -8,3 +8,4 @@ "main": "index.js", | ||
"test": "grunt test", | ||
"start": "node ./sandbox/server.js" | ||
"start": "node ./sandbox/server.js", | ||
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" | ||
}, | ||
@@ -32,2 +33,3 @@ "repository": { | ||
"devDependencies": { | ||
"coveralls": "^2.11.2", | ||
"grunt": "^0.4.5", | ||
@@ -38,2 +40,3 @@ "grunt-banner": "^0.3.1", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"grunt-eslint": "^9.0.0", | ||
"grunt-karma": "^0.10.1", | ||
@@ -44,5 +47,7 @@ "grunt-ts": "^3.0.0", | ||
"karma": "^0.12.31", | ||
"karma-coverage": "^0.2.7", | ||
"karma-jasmine": "^0.3.5", | ||
"karma-jasmine-ajax": "^0.1.12", | ||
"karma-phantomjs-launcher": "^0.1.4", | ||
"karma-webpack": "^1.5.0", | ||
"load-grunt-tasks": "^3.1.0", | ||
@@ -54,3 +59,6 @@ "webpack": "^1.7.2", | ||
"./lib/adapters/http.js": "./lib/adapters/xhr.js" | ||
}, | ||
"typescript": { | ||
"definition": "./axios.d.ts" | ||
} | ||
} |
@@ -1,6 +0,7 @@ | ||
#axios | ||
# axios | ||
[![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios) | ||
[![npm downloadsi](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios) | ||
[![build status](https://img.shields.io/travis/mzabriskie/axios.svg?style=flat-square)](https://travis-ci.org/mzabriskie/axios) | ||
[![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios) | ||
[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios) | ||
[![dependency status](https://img.shields.io/david/mzabriskie/axios.svg?style=flat-square)](https://david-dm.org/mzabriskie/axios) | ||
@@ -203,2 +204,5 @@ | ||
status: 200, | ||
// `statusText` is the HTTP status message from the server response | ||
statusText: 'OK', | ||
@@ -220,2 +224,3 @@ // `headers` the headers that the server responded with | ||
console.log(response.status); | ||
console.log(response.statusText); | ||
console.log(response.headers); | ||
@@ -222,0 +227,0 @@ console.log(response.config); |
@@ -0,1 +1,3 @@ | ||
var webpack = require('webpack'); | ||
var EXTERNAL_PROMISE = '{Promise: Promise}'; | ||
@@ -23,7 +25,5 @@ var config = {}; | ||
// TODO: UglifyJsPlugin doesn' work, but optimize.minimize is deprecated | ||
config[key + '-min'].optimize = {minimize: true}; | ||
// config[key + '-min'].pugins = [ | ||
// new webpack.optimize.UglifyJsPlugin() | ||
// ]; | ||
config[key + '-min'].plugins = [ | ||
new webpack.optimize.UglifyJsPlugin() | ||
]; | ||
}); | ||
@@ -30,0 +30,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1550560
56
6452
296
20