axios
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -9,4 +9,4 @@ # Changelog | ||
- Adding support for all and spread | ||
- Adding support for node | ||
- Adding support for `all` and `spread` | ||
- Adding support for node.js | ||
@@ -19,2 +19,8 @@ ### 0.2.1 (Sep 12, 2014) | ||
- Fixing bundling with browserify | ||
- Fixing bundling with browserify ([#4](https://github.com/mzabriskie/axios/issues/4)) | ||
### 0.3.0 (Sep 16, 2014) | ||
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/mzabriskie/axios/issues/8)) | ||
- Updating `then` and `catch` to receive response data as a signle object | ||
- Fixing issue with `all` not working ([#7](https://github.com/mzabriskie/axios/issues/7)) |
@@ -86,3 +86,3 @@ define("axios", ["undefined"], function(__WEBPACK_EXTERNAL_MODULE_2__) { return /******/ (function(modules) { // webpackBootstrap | ||
promise.then(function(response) { | ||
fn(response); | ||
fn(response.data, response.status, response.headers, response.config); | ||
}); | ||
@@ -95,3 +95,3 @@ return promise; | ||
promise.then(null, function(response) { | ||
fn(response); | ||
fn(response.data, response.status, response.headers, response.config); | ||
}); | ||
@@ -108,3 +108,5 @@ return promise; | ||
// Expose all/spread | ||
axios.all = Promise.all; | ||
axios.all = function (promises) { | ||
return Promise.all(promises); | ||
}; | ||
axios.spread = spread; | ||
@@ -443,8 +445,3 @@ | ||
? resolve | ||
: reject)( | ||
response.data, | ||
response.status, | ||
response.headers, | ||
response.config | ||
); | ||
: reject)(response); | ||
@@ -451,0 +448,0 @@ // Clean up request |
@@ -1,3 +0,3 @@ | ||
/* axios v0.2.2 | (c) 2014 by Matt Zabriskie */ | ||
define("axios",["undefined"],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(e){function r(){c.forEach(arguments,function(t){a[t]=function(e,n){return a(c.merge(n||{},{method:t,url:e}))}})}function o(){c.forEach(arguments,function(t){a[t]=function(e,n,r){return a(c.merge(r||{},{method:t,url:e,data:n}))}})}var i=n(13).Promise,s=n(3),c=n(4),u=n(5),a=t.exports=function(t){t=c.merge({method:"get",transformRequest:s.transformRequest,transformResponse:s.transformResponse},t),t.withCredentials=t.withCredentials||s.withCredentials;var r=new i(function(r,o){try{"undefined"!=typeof window?n(6)(r,o,t):"undefined"!=typeof e&&n(2)(r,o,t)}catch(i){o(i)}});return r.success=function(t){return r.then(function(e){t(e)}),r},r.error=function(t){return r.then(null,function(e){t(e)}),r},r};a.defaults=s,a.all=i.all,a.spread=u,r("delete","get","head"),o("post","put","patch")}).call(e,n(7))},function(t){var e=new Error('Cannot find module "undefined"');throw e.code="MODULE_NOT_FOUND",e},function(t,e,n){"use strict";var r=n(4),o=/^\s*(\[|\{[^\{])/,i=/[\}\]]\s*$/,s=/^\)\]\}',?\n/,c={"Content-Type":"application/json;charset=utf-8"};t.exports={transformRequest:[function(t){return!r.isObject(t)||r.isFile(t)||r.isBlob(t)?null: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(c),post:r.merge(c),put:r.merge(c)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t){function e(t){return"[object Array]"===l.call(t)}function n(t){return"string"==typeof t}function r(t){return"number"==typeof t}function o(t){return null!==t&&"object"==typeof t}function i(t){return"[object Date]"===l.call(t)}function s(t){return"[object File]"===l.call(t)}function c(t){return"[object Blob]"===l.call(t)}function u(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function a(t,e){if(null!==t&&"undefined"!=typeof t){var n=t.constructor===Array||"function"==typeof t.callee;if("object"==typeof t||n||(t=[t]),n)for(var r=0,o=t.length;o>r;r++)e.call(null,t[r],r,t);else for(var i in t)t.hasOwnProperty(i)&&e.call(null,t[i],i,t)}}function f(){var t={};return a(arguments,function(e){a(e,function(e,n){t[n]=e})}),t}var l=Object.prototype.toString;t.exports={isArray:e,isString:n,isNumber:r,isObject:o,isDate:i,isFile:s,isBlob:c,forEach:a,merge:f,trim:u}},function(t){t.exports=function(t){return function(e){t.apply(null,e)}}},function(t,e,n){var r=n(8),o=n(9),i=n(3),s=n(10),c=n(11),u=n(12),a=n(4);t.exports=function(t,e,n){var f=c(n.data,n.headers,n.transformRequest),l=a.merge(i.headers.common,i.headers[n.method]||{},n.headers||{}),p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method,r(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=s(p.getAllResponseHeaders()),o={data:c(p.responseText,r,n.transformResponse),status:p.status,headers:r,config:n};(p.status>=200&&p.status<300?t:e)(o.data,o.status,o.headers,o.config),p=null}};var d=u(n.url)?o.read(n.xsrfCookieName||i.xsrfCookieName):void 0;if(d&&(l[n.xsrfHeaderName||i.xsrfHeaderName]=d),a.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(h){if("json"!==p.responseType)throw h}p.send(f)}},function(t){function e(){}var n=t.exports={};n.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.on=e,n.addListener=e,n.once=e,n.off=e,n.removeListener=e,n.removeAllListeners=e,n.emit=e,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")}},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 c=[];c.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&c.push("expires="+new Date(n).toGMTString()),r.isString(o)&&c.push("path="+o),r.isString(i)&&c.push("domain="+i),s===!0&&c.push("secure"),document.cookie=c.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 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(4),s=document.createElement("a"),c=r(window.location.href);t.exports=function(t){var e=i.isString(t)?r(t):t;return e.protocol===c.protocol&&e.host===c.host}},function(t,e,n){"use strict";var r=n(14).Promise,o=n(15).polyfill;e.Promise=r,e.polyfill=o},function(t,e,n){"use strict";function r(t){if(!v(t))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof r))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],o(t,this)}function o(t,e){function n(t){a(e,t)}function r(t){l(e,t)}try{t(n,r)}catch(o){r(o)}}function i(t,e,n,r){var o,i,s,c,f=v(n);if(f)try{o=n(r),s=!0}catch(p){c=!0,i=p}else o=r,s=!0;u(e,o)||(f&&s?a(e,o):c?l(e,i):t===T?a(e,o):t===O&&l(e,o))}function s(t,e,n,r){var o=t._subscribers,i=o.length;o[i]=e,o[i+T]=n,o[i+O]=r}function c(t,e){for(var n,r,o=t._subscribers,s=t._detail,c=0;c<o.length;c+=3)n=o[c],r=o[c+e],i(e,n,r,s);t._subscribers=null}function u(t,e){var n,r=null;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(m(e)&&(r=e.then,v(r)))return r.call(e,function(r){return n?!0:(n=!0,void(e!==r?a(t,r):f(t,r)))},function(e){return n?!0:(n=!0,void l(t,e))}),!0}catch(o){return n?!0:(l(t,o),!0)}return!1}function a(t,e){t===e?f(t,e):u(t,e)||f(t,e)}function f(t,e){t._state===j&&(t._state=E,t._detail=e,h.async(p,t))}function l(t,e){t._state===j&&(t._state=E,t._detail=e,h.async(d,t))}function p(t){c(t,t._state=T)}function d(t){c(t,t._state=O)}var h=n(16).config,m=(n(16).configure,n(17).objectOrFunction),v=n(17).isFunction,w=(n(17).now,n(18).all),g=n(19).race,y=n(20).resolve,b=n(21).reject,x=n(22).asap;h.async=x;var j=void 0,E=0,T=1,O=2;r.prototype={constructor:r,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(t,e){var n=this,r=new this.constructor(function(){});if(this._state){var o=arguments;h.async(function(){i(n._state,r,o[n._state-1],n._detail)})}else s(this,r,t,e);return r},"catch":function(t){return this.then(null,t)}},r.all=w,r.race=g,r.resolve=y,r.reject=b,e.Promise=r},function(t,e,n){(function(t){"use strict";function r(){var e;e="undefined"!=typeof t?t:"undefined"!=typeof window&&window.document?window:self;var n="Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var t;return new e.Promise(function(e){t=e}),i(t)}();n||(e.Promise=o)}var o=n(14).Promise,i=n(17).isFunction;e.polyfill=r}).call(e,function(){return this}())},function(t,e){"use strict";function n(t,e){return 2!==arguments.length?r[t]:void(r[t]=e)}var r={instrument:!1};e.config=r,e.configure=n},function(t,e){"use strict";function n(t){return r(t)||"object"==typeof t&&null!==t}function r(t){return"function"==typeof t}function o(t){return"[object Array]"===Object.prototype.toString.call(t)}var i=Date.now||function(){return(new Date).getTime()};e.objectOrFunction=n,e.isFunction=r,e.isArray=o,e.now=i},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to all.");return new e(function(e,n){function r(t){return function(e){o(t,e)}}function o(t,n){c[t]=n,0===--u&&e(c)}var s,c=[],u=t.length;0===u&&e([]);for(var a=0;a<t.length;a++)s=t[a],s&&i(s.then)?s.then(r(a),n):o(a,s)})}var o=n(17).isArray,i=n(17).isFunction;e.all=r},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to race.");return new e(function(e,n){for(var r,o=0;o<t.length;o++)r=t[o],r&&"function"==typeof r.then?r.then(e,n):e(r)})}var o=n(17).isArray;e.race=r},function(t,e){"use strict";function n(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=this;return new e(function(e){e(t)})}e.resolve=n},function(t,e){"use strict";function n(t){var e=this;return new e(function(e,n){n(t)})}e.reject=n},function(t,e,n){(function(t,n){"use strict";function r(){return function(){n.nextTick(s)}}function o(){var t=0,e=new f(s),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function i(){return function(){l.setTimeout(s,1)}}function s(){for(var t=0;t<p.length;t++){var e=p[t],n=e[0],r=e[1];n(r)}p=[]}function c(t,e){var n=p.push([t,e]);1===n&&u()}var u,a="undefined"!=typeof window?window:{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"!=typeof t?t:void 0===this?window:this,p=[];u="undefined"!=typeof n&&"[object process]"==={}.toString.call(n)?r():f?o():i(),e.asap=c}).call(e,function(){return this}(),n(7))}])}); | ||
/* axios v0.3.0 | (c) 2014 by Matt Zabriskie */ | ||
define("axios",["undefined"],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(e){function r(){u.forEach(arguments,function(t){a[t]=function(e,n){return a(u.merge(n||{},{method:t,url:e}))}})}function o(){u.forEach(arguments,function(t){a[t]=function(e,n,r){return a(u.merge(r||{},{method:t,url:e,data:n}))}})}var i=n(13).Promise,s=n(3),u=n(4),c=n(5),a=t.exports=function(t){t=u.merge({method:"get",transformRequest:s.transformRequest,transformResponse:s.transformResponse},t),t.withCredentials=t.withCredentials||s.withCredentials;var r=new i(function(r,o){try{"undefined"!=typeof window?n(6)(r,o,t):"undefined"!=typeof e&&n(2)(r,o,t)}catch(i){o(i)}});return r.success=function(t){return r.then(function(e){t(e.data,e.status,e.headers,e.config)}),r},r.error=function(t){return r.then(null,function(e){t(e.data,e.status,e.headers,e.config)}),r},r};a.defaults=s,a.all=function(t){return i.all(t)},a.spread=c,r("delete","get","head"),o("post","put","patch")}).call(e,n(7))},function(t){var e=new Error('Cannot find module "undefined"');throw e.code="MODULE_NOT_FOUND",e},function(t,e,n){"use strict";var r=n(4),o=/^\s*(\[|\{[^\{])/,i=/[\}\]]\s*$/,s=/^\)\]\}',?\n/,u={"Content-Type":"application/json;charset=utf-8"};t.exports={transformRequest:[function(t){return!r.isObject(t)||r.isFile(t)||r.isBlob(t)?null: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]"===l.call(t)}function n(t){return"string"==typeof t}function r(t){return"number"==typeof t}function o(t){return null!==t&&"object"==typeof t}function i(t){return"[object Date]"===l.call(t)}function s(t){return"[object File]"===l.call(t)}function u(t){return"[object Blob]"===l.call(t)}function c(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function a(t,e){if(null!==t&&"undefined"!=typeof t){var n=t.constructor===Array||"function"==typeof t.callee;if("object"==typeof t||n||(t=[t]),n)for(var r=0,o=t.length;o>r;r++)e.call(null,t[r],r,t);else for(var i in t)t.hasOwnProperty(i)&&e.call(null,t[i],i,t)}}function f(){var t={};return a(arguments,function(e){a(e,function(e,n){t[n]=e})}),t}var l=Object.prototype.toString;t.exports={isArray:e,isString:n,isNumber:r,isObject:o,isDate:i,isFile:s,isBlob:u,forEach:a,merge:f,trim:c}},function(t){t.exports=function(t){return function(e){t.apply(null,e)}}},function(t,e,n){var r=n(8),o=n(9),i=n(3),s=n(10),u=n(11),c=n(12),a=n(4);t.exports=function(t,e,n){var f=u(n.data,n.headers,n.transformRequest),l=a.merge(i.headers.common,i.headers[n.method]||{},n.headers||{}),p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method,r(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=s(p.getAllResponseHeaders()),o={data:u(p.responseText,r,n.transformResponse),status:p.status,headers:r,config:n};(p.status>=200&&p.status<300?t:e)(o),p=null}};var d=c(n.url)?o.read(n.xsrfCookieName||i.xsrfCookieName):void 0;if(d&&(l[n.xsrfHeaderName||i.xsrfHeaderName]=d),a.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(h){if("json"!==p.responseType)throw h}p.send(f)}},function(t){function e(){}var n=t.exports={};n.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.on=e,n.addListener=e,n.once=e,n.off=e,n.removeListener=e,n.removeAllListeners=e,n.emit=e,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")}},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 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(4),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,e,n){"use strict";var r=n(14).Promise,o=n(15).polyfill;e.Promise=r,e.polyfill=o},function(t,e,n){"use strict";function r(t){if(!v(t))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof r))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],o(t,this)}function o(t,e){function n(t){a(e,t)}function r(t){l(e,t)}try{t(n,r)}catch(o){r(o)}}function i(t,e,n,r){var o,i,s,u,f=v(n);if(f)try{o=n(r),s=!0}catch(p){u=!0,i=p}else o=r,s=!0;c(e,o)||(f&&s?a(e,o):u?l(e,i):t===T?a(e,o):t===O&&l(e,o))}function s(t,e,n,r){var o=t._subscribers,i=o.length;o[i]=e,o[i+T]=n,o[i+O]=r}function u(t,e){for(var n,r,o=t._subscribers,s=t._detail,u=0;u<o.length;u+=3)n=o[u],r=o[u+e],i(e,n,r,s);t._subscribers=null}function c(t,e){var n,r=null;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(m(e)&&(r=e.then,v(r)))return r.call(e,function(r){return n?!0:(n=!0,void(e!==r?a(t,r):f(t,r)))},function(e){return n?!0:(n=!0,void l(t,e))}),!0}catch(o){return n?!0:(l(t,o),!0)}return!1}function a(t,e){t===e?f(t,e):c(t,e)||f(t,e)}function f(t,e){t._state===j&&(t._state=E,t._detail=e,h.async(p,t))}function l(t,e){t._state===j&&(t._state=E,t._detail=e,h.async(d,t))}function p(t){u(t,t._state=T)}function d(t){u(t,t._state=O)}var h=n(16).config,m=(n(16).configure,n(17).objectOrFunction),v=n(17).isFunction,w=(n(17).now,n(18).all),g=n(19).race,y=n(20).resolve,b=n(21).reject,x=n(22).asap;h.async=x;var j=void 0,E=0,T=1,O=2;r.prototype={constructor:r,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(t,e){var n=this,r=new this.constructor(function(){});if(this._state){var o=arguments;h.async(function(){i(n._state,r,o[n._state-1],n._detail)})}else s(this,r,t,e);return r},"catch":function(t){return this.then(null,t)}},r.all=w,r.race=g,r.resolve=y,r.reject=b,e.Promise=r},function(t,e,n){(function(t){"use strict";function r(){var e;e="undefined"!=typeof t?t:"undefined"!=typeof window&&window.document?window:self;var n="Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var t;return new e.Promise(function(e){t=e}),i(t)}();n||(e.Promise=o)}var o=n(14).Promise,i=n(17).isFunction;e.polyfill=r}).call(e,function(){return this}())},function(t,e){"use strict";function n(t,e){return 2!==arguments.length?r[t]:void(r[t]=e)}var r={instrument:!1};e.config=r,e.configure=n},function(t,e){"use strict";function n(t){return r(t)||"object"==typeof t&&null!==t}function r(t){return"function"==typeof t}function o(t){return"[object Array]"===Object.prototype.toString.call(t)}var i=Date.now||function(){return(new Date).getTime()};e.objectOrFunction=n,e.isFunction=r,e.isArray=o,e.now=i},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to all.");return new e(function(e,n){function r(t){return function(e){o(t,e)}}function o(t,n){u[t]=n,0===--c&&e(u)}var s,u=[],c=t.length;0===c&&e([]);for(var a=0;a<t.length;a++)s=t[a],s&&i(s.then)?s.then(r(a),n):o(a,s)})}var o=n(17).isArray,i=n(17).isFunction;e.all=r},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to race.");return new e(function(e,n){for(var r,o=0;o<t.length;o++)r=t[o],r&&"function"==typeof r.then?r.then(e,n):e(r)})}var o=n(17).isArray;e.race=r},function(t,e){"use strict";function n(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=this;return new e(function(e){e(t)})}e.resolve=n},function(t,e){"use strict";function n(t){var e=this;return new e(function(e,n){n(t)})}e.reject=n},function(t,e,n){(function(t,n){"use strict";function r(){return function(){n.nextTick(s)}}function o(){var t=0,e=new f(s),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function i(){return function(){l.setTimeout(s,1)}}function s(){for(var t=0;t<p.length;t++){var e=p[t],n=e[0],r=e[1];n(r)}p=[]}function u(t,e){var n=p.push([t,e]);1===n&&c()}var c,a="undefined"!=typeof window?window:{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"!=typeof t?t:void 0===this?window:this,p=[];c="undefined"!=typeof n&&"[object process]"==={}.toString.call(n)?r():f?o():i(),e.asap=u}).call(e,function(){return this}(),n(7))}])}); | ||
//# sourceMappingURL=axios.amd.min.map |
@@ -87,3 +87,3 @@ var axios = | ||
promise.then(function(response) { | ||
fn(response); | ||
fn(response.data, response.status, response.headers, response.config); | ||
}); | ||
@@ -96,3 +96,3 @@ return promise; | ||
promise.then(null, function(response) { | ||
fn(response); | ||
fn(response.data, response.status, response.headers, response.config); | ||
}); | ||
@@ -109,3 +109,5 @@ return promise; | ||
// Expose all/spread | ||
axios.all = Promise.all; | ||
axios.all = function (promises) { | ||
return Promise.all(promises); | ||
}; | ||
axios.spread = spread; | ||
@@ -444,8 +446,3 @@ | ||
? resolve | ||
: reject)( | ||
response.data, | ||
response.status, | ||
response.headers, | ||
response.config | ||
); | ||
: reject)(response); | ||
@@ -452,0 +449,0 @@ // Clean up request |
@@ -1,3 +0,3 @@ | ||
/* axios v0.2.2 | (c) 2014 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(e){function r(){c.forEach(arguments,function(t){a[t]=function(e,n){return a(c.merge(n||{},{method:t,url:e}))}})}function o(){c.forEach(arguments,function(t){a[t]=function(e,n,r){return a(c.merge(r||{},{method:t,url:e,data:n}))}})}var i=n(13).Promise,s=n(3),c=n(4),u=n(5),a=t.exports=function(t){t=c.merge({method:"get",transformRequest:s.transformRequest,transformResponse:s.transformResponse},t),t.withCredentials=t.withCredentials||s.withCredentials;var r=new i(function(r,o){try{"undefined"!=typeof window?n(6)(r,o,t):"undefined"!=typeof e&&n(2)(r,o,t)}catch(i){o(i)}});return r.success=function(t){return r.then(function(e){t(e)}),r},r.error=function(t){return r.then(null,function(e){t(e)}),r},r};a.defaults=s,a.all=i.all,a.spread=u,r("delete","get","head"),o("post","put","patch")}).call(e,n(7))},function(t){var e=new Error('Cannot find module "undefined"');throw e.code="MODULE_NOT_FOUND",e},function(t,e,n){"use strict";var r=n(4),o=/^\s*(\[|\{[^\{])/,i=/[\}\]]\s*$/,s=/^\)\]\}',?\n/,c={"Content-Type":"application/json;charset=utf-8"};t.exports={transformRequest:[function(t){return!r.isObject(t)||r.isFile(t)||r.isBlob(t)?null: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(c),post:r.merge(c),put:r.merge(c)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t){function e(t){return"[object Array]"===l.call(t)}function n(t){return"string"==typeof t}function r(t){return"number"==typeof t}function o(t){return null!==t&&"object"==typeof t}function i(t){return"[object Date]"===l.call(t)}function s(t){return"[object File]"===l.call(t)}function c(t){return"[object Blob]"===l.call(t)}function u(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function a(t,e){if(null!==t&&"undefined"!=typeof t){var n=t.constructor===Array||"function"==typeof t.callee;if("object"==typeof t||n||(t=[t]),n)for(var r=0,o=t.length;o>r;r++)e.call(null,t[r],r,t);else for(var i in t)t.hasOwnProperty(i)&&e.call(null,t[i],i,t)}}function f(){var t={};return a(arguments,function(e){a(e,function(e,n){t[n]=e})}),t}var l=Object.prototype.toString;t.exports={isArray:e,isString:n,isNumber:r,isObject:o,isDate:i,isFile:s,isBlob:c,forEach:a,merge:f,trim:u}},function(t){t.exports=function(t){return function(e){t.apply(null,e)}}},function(t,e,n){var r=n(8),o=n(9),i=n(3),s=n(10),c=n(11),u=n(12),a=n(4);t.exports=function(t,e,n){var f=c(n.data,n.headers,n.transformRequest),l=a.merge(i.headers.common,i.headers[n.method]||{},n.headers||{}),p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method,r(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=s(p.getAllResponseHeaders()),o={data:c(p.responseText,r,n.transformResponse),status:p.status,headers:r,config:n};(p.status>=200&&p.status<300?t:e)(o.data,o.status,o.headers,o.config),p=null}};var d=u(n.url)?o.read(n.xsrfCookieName||i.xsrfCookieName):void 0;if(d&&(l[n.xsrfHeaderName||i.xsrfHeaderName]=d),a.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(h){if("json"!==p.responseType)throw h}p.send(f)}},function(t){function e(){}var n=t.exports={};n.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.on=e,n.addListener=e,n.once=e,n.off=e,n.removeListener=e,n.removeAllListeners=e,n.emit=e,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")}},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 c=[];c.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&c.push("expires="+new Date(n).toGMTString()),r.isString(o)&&c.push("path="+o),r.isString(i)&&c.push("domain="+i),s===!0&&c.push("secure"),document.cookie=c.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 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(4),s=document.createElement("a"),c=r(window.location.href);t.exports=function(t){var e=i.isString(t)?r(t):t;return e.protocol===c.protocol&&e.host===c.host}},function(t,e,n){"use strict";var r=n(14).Promise,o=n(15).polyfill;e.Promise=r,e.polyfill=o},function(t,e,n){"use strict";function r(t){if(!v(t))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof r))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],o(t,this)}function o(t,e){function n(t){a(e,t)}function r(t){l(e,t)}try{t(n,r)}catch(o){r(o)}}function i(t,e,n,r){var o,i,s,c,f=v(n);if(f)try{o=n(r),s=!0}catch(p){c=!0,i=p}else o=r,s=!0;u(e,o)||(f&&s?a(e,o):c?l(e,i):t===T?a(e,o):t===O&&l(e,o))}function s(t,e,n,r){var o=t._subscribers,i=o.length;o[i]=e,o[i+T]=n,o[i+O]=r}function c(t,e){for(var n,r,o=t._subscribers,s=t._detail,c=0;c<o.length;c+=3)n=o[c],r=o[c+e],i(e,n,r,s);t._subscribers=null}function u(t,e){var n,r=null;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(m(e)&&(r=e.then,v(r)))return r.call(e,function(r){return n?!0:(n=!0,void(e!==r?a(t,r):f(t,r)))},function(e){return n?!0:(n=!0,void l(t,e))}),!0}catch(o){return n?!0:(l(t,o),!0)}return!1}function a(t,e){t===e?f(t,e):u(t,e)||f(t,e)}function f(t,e){t._state===j&&(t._state=E,t._detail=e,h.async(p,t))}function l(t,e){t._state===j&&(t._state=E,t._detail=e,h.async(d,t))}function p(t){c(t,t._state=T)}function d(t){c(t,t._state=O)}var h=n(16).config,m=(n(16).configure,n(17).objectOrFunction),v=n(17).isFunction,w=(n(17).now,n(18).all),g=n(19).race,y=n(20).resolve,b=n(21).reject,x=n(22).asap;h.async=x;var j=void 0,E=0,T=1,O=2;r.prototype={constructor:r,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(t,e){var n=this,r=new this.constructor(function(){});if(this._state){var o=arguments;h.async(function(){i(n._state,r,o[n._state-1],n._detail)})}else s(this,r,t,e);return r},"catch":function(t){return this.then(null,t)}},r.all=w,r.race=g,r.resolve=y,r.reject=b,e.Promise=r},function(t,e,n){(function(t){"use strict";function r(){var e;e="undefined"!=typeof t?t:"undefined"!=typeof window&&window.document?window:self;var n="Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var t;return new e.Promise(function(e){t=e}),i(t)}();n||(e.Promise=o)}var o=n(14).Promise,i=n(17).isFunction;e.polyfill=r}).call(e,function(){return this}())},function(t,e){"use strict";function n(t,e){return 2!==arguments.length?r[t]:void(r[t]=e)}var r={instrument:!1};e.config=r,e.configure=n},function(t,e){"use strict";function n(t){return r(t)||"object"==typeof t&&null!==t}function r(t){return"function"==typeof t}function o(t){return"[object Array]"===Object.prototype.toString.call(t)}var i=Date.now||function(){return(new Date).getTime()};e.objectOrFunction=n,e.isFunction=r,e.isArray=o,e.now=i},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to all.");return new e(function(e,n){function r(t){return function(e){o(t,e)}}function o(t,n){c[t]=n,0===--u&&e(c)}var s,c=[],u=t.length;0===u&&e([]);for(var a=0;a<t.length;a++)s=t[a],s&&i(s.then)?s.then(r(a),n):o(a,s)})}var o=n(17).isArray,i=n(17).isFunction;e.all=r},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to race.");return new e(function(e,n){for(var r,o=0;o<t.length;o++)r=t[o],r&&"function"==typeof r.then?r.then(e,n):e(r)})}var o=n(17).isArray;e.race=r},function(t,e){"use strict";function n(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=this;return new e(function(e){e(t)})}e.resolve=n},function(t,e){"use strict";function n(t){var e=this;return new e(function(e,n){n(t)})}e.reject=n},function(t,e,n){(function(t,n){"use strict";function r(){return function(){n.nextTick(s)}}function o(){var t=0,e=new f(s),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function i(){return function(){l.setTimeout(s,1)}}function s(){for(var t=0;t<p.length;t++){var e=p[t],n=e[0],r=e[1];n(r)}p=[]}function c(t,e){var n=p.push([t,e]);1===n&&u()}var u,a="undefined"!=typeof window?window:{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"!=typeof t?t:void 0===this?window:this,p=[];u="undefined"!=typeof n&&"[object process]"==={}.toString.call(n)?r():f?o():i(),e.asap=c}).call(e,function(){return this}(),n(7))}]); | ||
/* axios v0.3.0 | (c) 2014 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(e){function r(){u.forEach(arguments,function(t){a[t]=function(e,n){return a(u.merge(n||{},{method:t,url:e}))}})}function o(){u.forEach(arguments,function(t){a[t]=function(e,n,r){return a(u.merge(r||{},{method:t,url:e,data:n}))}})}var i=n(13).Promise,s=n(3),u=n(4),c=n(5),a=t.exports=function(t){t=u.merge({method:"get",transformRequest:s.transformRequest,transformResponse:s.transformResponse},t),t.withCredentials=t.withCredentials||s.withCredentials;var r=new i(function(r,o){try{"undefined"!=typeof window?n(6)(r,o,t):"undefined"!=typeof e&&n(2)(r,o,t)}catch(i){o(i)}});return r.success=function(t){return r.then(function(e){t(e.data,e.status,e.headers,e.config)}),r},r.error=function(t){return r.then(null,function(e){t(e.data,e.status,e.headers,e.config)}),r},r};a.defaults=s,a.all=function(t){return i.all(t)},a.spread=c,r("delete","get","head"),o("post","put","patch")}).call(e,n(7))},function(t){var e=new Error('Cannot find module "undefined"');throw e.code="MODULE_NOT_FOUND",e},function(t,e,n){"use strict";var r=n(4),o=/^\s*(\[|\{[^\{])/,i=/[\}\]]\s*$/,s=/^\)\]\}',?\n/,u={"Content-Type":"application/json;charset=utf-8"};t.exports={transformRequest:[function(t){return!r.isObject(t)||r.isFile(t)||r.isBlob(t)?null: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]"===l.call(t)}function n(t){return"string"==typeof t}function r(t){return"number"==typeof t}function o(t){return null!==t&&"object"==typeof t}function i(t){return"[object Date]"===l.call(t)}function s(t){return"[object File]"===l.call(t)}function u(t){return"[object Blob]"===l.call(t)}function c(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function a(t,e){if(null!==t&&"undefined"!=typeof t){var n=t.constructor===Array||"function"==typeof t.callee;if("object"==typeof t||n||(t=[t]),n)for(var r=0,o=t.length;o>r;r++)e.call(null,t[r],r,t);else for(var i in t)t.hasOwnProperty(i)&&e.call(null,t[i],i,t)}}function f(){var t={};return a(arguments,function(e){a(e,function(e,n){t[n]=e})}),t}var l=Object.prototype.toString;t.exports={isArray:e,isString:n,isNumber:r,isObject:o,isDate:i,isFile:s,isBlob:u,forEach:a,merge:f,trim:c}},function(t){t.exports=function(t){return function(e){t.apply(null,e)}}},function(t,e,n){var r=n(8),o=n(9),i=n(3),s=n(10),u=n(11),c=n(12),a=n(4);t.exports=function(t,e,n){var f=u(n.data,n.headers,n.transformRequest),l=a.merge(i.headers.common,i.headers[n.method]||{},n.headers||{}),p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");p.open(n.method,r(n.url,n.params),!0),p.onreadystatechange=function(){if(p&&4===p.readyState){var r=s(p.getAllResponseHeaders()),o={data:u(p.responseText,r,n.transformResponse),status:p.status,headers:r,config:n};(p.status>=200&&p.status<300?t:e)(o),p=null}};var d=c(n.url)?o.read(n.xsrfCookieName||i.xsrfCookieName):void 0;if(d&&(l[n.xsrfHeaderName||i.xsrfHeaderName]=d),a.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(h){if("json"!==p.responseType)throw h}p.send(f)}},function(t){function e(){}var n=t.exports={};n.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.on=e,n.addListener=e,n.once=e,n.off=e,n.removeListener=e,n.removeAllListeners=e,n.emit=e,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")}},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 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(4),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,e,n){"use strict";var r=n(14).Promise,o=n(15).polyfill;e.Promise=r,e.polyfill=o},function(t,e,n){"use strict";function r(t){if(!v(t))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof r))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],o(t,this)}function o(t,e){function n(t){a(e,t)}function r(t){l(e,t)}try{t(n,r)}catch(o){r(o)}}function i(t,e,n,r){var o,i,s,u,f=v(n);if(f)try{o=n(r),s=!0}catch(p){u=!0,i=p}else o=r,s=!0;c(e,o)||(f&&s?a(e,o):u?l(e,i):t===T?a(e,o):t===O&&l(e,o))}function s(t,e,n,r){var o=t._subscribers,i=o.length;o[i]=e,o[i+T]=n,o[i+O]=r}function u(t,e){for(var n,r,o=t._subscribers,s=t._detail,u=0;u<o.length;u+=3)n=o[u],r=o[u+e],i(e,n,r,s);t._subscribers=null}function c(t,e){var n,r=null;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(m(e)&&(r=e.then,v(r)))return r.call(e,function(r){return n?!0:(n=!0,void(e!==r?a(t,r):f(t,r)))},function(e){return n?!0:(n=!0,void l(t,e))}),!0}catch(o){return n?!0:(l(t,o),!0)}return!1}function a(t,e){t===e?f(t,e):c(t,e)||f(t,e)}function f(t,e){t._state===j&&(t._state=E,t._detail=e,h.async(p,t))}function l(t,e){t._state===j&&(t._state=E,t._detail=e,h.async(d,t))}function p(t){u(t,t._state=T)}function d(t){u(t,t._state=O)}var h=n(16).config,m=(n(16).configure,n(17).objectOrFunction),v=n(17).isFunction,w=(n(17).now,n(18).all),g=n(19).race,y=n(20).resolve,b=n(21).reject,x=n(22).asap;h.async=x;var j=void 0,E=0,T=1,O=2;r.prototype={constructor:r,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(t,e){var n=this,r=new this.constructor(function(){});if(this._state){var o=arguments;h.async(function(){i(n._state,r,o[n._state-1],n._detail)})}else s(this,r,t,e);return r},"catch":function(t){return this.then(null,t)}},r.all=w,r.race=g,r.resolve=y,r.reject=b,e.Promise=r},function(t,e,n){(function(t){"use strict";function r(){var e;e="undefined"!=typeof t?t:"undefined"!=typeof window&&window.document?window:self;var n="Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var t;return new e.Promise(function(e){t=e}),i(t)}();n||(e.Promise=o)}var o=n(14).Promise,i=n(17).isFunction;e.polyfill=r}).call(e,function(){return this}())},function(t,e){"use strict";function n(t,e){return 2!==arguments.length?r[t]:void(r[t]=e)}var r={instrument:!1};e.config=r,e.configure=n},function(t,e){"use strict";function n(t){return r(t)||"object"==typeof t&&null!==t}function r(t){return"function"==typeof t}function o(t){return"[object Array]"===Object.prototype.toString.call(t)}var i=Date.now||function(){return(new Date).getTime()};e.objectOrFunction=n,e.isFunction=r,e.isArray=o,e.now=i},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to all.");return new e(function(e,n){function r(t){return function(e){o(t,e)}}function o(t,n){u[t]=n,0===--c&&e(u)}var s,u=[],c=t.length;0===c&&e([]);for(var a=0;a<t.length;a++)s=t[a],s&&i(s.then)?s.then(r(a),n):o(a,s)})}var o=n(17).isArray,i=n(17).isFunction;e.all=r},function(t,e,n){"use strict";function r(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to race.");return new e(function(e,n){for(var r,o=0;o<t.length;o++)r=t[o],r&&"function"==typeof r.then?r.then(e,n):e(r)})}var o=n(17).isArray;e.race=r},function(t,e){"use strict";function n(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=this;return new e(function(e){e(t)})}e.resolve=n},function(t,e){"use strict";function n(t){var e=this;return new e(function(e,n){n(t)})}e.reject=n},function(t,e,n){(function(t,n){"use strict";function r(){return function(){n.nextTick(s)}}function o(){var t=0,e=new f(s),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function i(){return function(){l.setTimeout(s,1)}}function s(){for(var t=0;t<p.length;t++){var e=p[t],n=e[0],r=e[1];n(r)}p=[]}function u(t,e){var n=p.push([t,e]);1===n&&c()}var c,a="undefined"!=typeof window?window:{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"!=typeof t?t:void 0===this?window:this,p=[];c="undefined"!=typeof n&&"[object process]"==={}.toString.call(n)?r():f?o():i(),e.asap=u}).call(e,function(){return this}(),n(7))}]); | ||
//# sourceMappingURL=axios.min.map |
@@ -55,8 +55,3 @@ var buildUrl = require('./../buildUrl'); | ||
? resolve | ||
: reject)( | ||
response.data, | ||
response.status, | ||
response.headers, | ||
response.config | ||
); | ||
: reject)(response); | ||
}); | ||
@@ -63,0 +58,0 @@ }); |
@@ -47,8 +47,3 @@ var buildUrl = require('./../buildUrl'); | ||
? resolve | ||
: reject)( | ||
response.data, | ||
response.status, | ||
response.headers, | ||
response.config | ||
); | ||
: reject)(response); | ||
@@ -55,0 +50,0 @@ // Clean up request |
@@ -34,3 +34,3 @@ var Promise = require('es6-promise').Promise; | ||
promise.then(function(response) { | ||
fn(response); | ||
fn(response.data, response.status, response.headers, response.config); | ||
}); | ||
@@ -43,3 +43,3 @@ return promise; | ||
promise.then(null, function(response) { | ||
fn(response); | ||
fn(response.data, response.status, response.headers, response.config); | ||
}); | ||
@@ -56,3 +56,5 @@ return promise; | ||
// Expose all/spread | ||
axios.all = Promise.all; | ||
axios.all = function (promises) { | ||
return Promise.all(promises); | ||
}; | ||
axios.spread = spread; | ||
@@ -59,0 +61,0 @@ |
{ | ||
"name": "axios", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Promise based HTTP client for the browser and node.js", | ||
@@ -34,3 +34,3 @@ "main": "index.js", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"webpack": "^1.3.3-beta2", | ||
"webpack": "^1.4.0-beta9", | ||
"webpack-dev-server": "^1.4.10", | ||
@@ -37,0 +37,0 @@ "grunt-webpack": "^1.0.8", |
@@ -105,3 +105,3 @@ # axios [![Build Status](https://travis-ci.org/mzabriskie/axios.svg?branch=master)](https://travis-ci.org/mzabriskie/axios) | ||
## Request API | ||
## axios API | ||
@@ -140,3 +140,3 @@ Requests can be made by passing the relevant config to `axios`. | ||
### Config | ||
## Request API | ||
@@ -201,21 +201,42 @@ This is the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified. | ||
For either `success` or `error`, the following response will be provided. | ||
The response for a request contains the following information. | ||
```js | ||
{ | ||
// `data` is the response that was provided by the server | ||
data: {}, | ||
// `status` is the HTTP status code from the server response | ||
status: 200, | ||
// `headers` the headers that the server responded with | ||
headers: {}, | ||
// `config` is the config that was provided to `axios` for the request | ||
config: {} | ||
} | ||
``` | ||
When using `then` or `catch`, you will receive a single response object. | ||
```js | ||
axios.get('/user/12345') | ||
.success(function ( | ||
// `data` is the response that was provided by the server | ||
data, | ||
// `status` is the HTTP status code from the server response | ||
status, | ||
// `headers` the headers that the server responded with | ||
headers, | ||
// `config` is the config that was provided to `axios` for the request | ||
config | ||
) { | ||
// Do something with result | ||
.then(function(response) { | ||
console.log(response.data); | ||
console.log(response.status); | ||
console.log(response.headers); | ||
console.log(response.config); | ||
}); | ||
``` | ||
For either `success` or `error`, the response is broken up into individual arguments. | ||
```js | ||
axios.get('/user/12345') | ||
.success(function (data, status, headers, config) { | ||
console.log(data); | ||
console.log(status); | ||
console.log(headers); | ||
console.log(config); | ||
}); | ||
} | ||
@@ -222,0 +243,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
395217
250
3001