Socket
Socket
Sign inDemoInstall

axios-mock-adapter

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-mock-adapter - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

README.md

111

dist/axios-mock-adapter.min.js

@@ -1,1 +0,110 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AxiosMockAdapter=t():e.AxiosMockAdapter=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var s=n[r]={exports:{},id:r,loaded:!1};return e[r].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(){return function(e,t,n){var r=n.url.slice(n.baseURL?n.baseURL.length:0),s=a.findHandler(this.handlers,n.method,r);if(s){a.purgeIfReplyOnce(this,s);var o=s[1]instanceof Function?s[1](n):s.slice(1);a.settle(e,t,{status:o[0],data:o[1],headers:o[2],config:n},this.delayResponse)}else a.settle(e,t,{status:404,config:n},this.delayResponse)}.bind(this)}function s(){this.handlers=i.reduce(function(e,t){return e[t]=[],e},{}),this.replyOnceHandlers=[]}function o(e,t){s.call(this),e&&(this.axiosInstance=e,this.originalAdapter=e.defaults.adapter,this.delayResponse=t&&t.delayResponse>0?t.delayResponse:null,e.defaults.adapter=r.call(this))}var a=n(1),i=["get","post","head","delete","patch","put"];o.prototype.adapter=r,o.prototype.restore=function(){this.axiosInstance&&(this.axiosInstance.defaults.adapter=this.originalAdapter)},o.prototype.reset=s,o.prototype.onAny=function(e){var t=this;return{reply:function(n,r,s){var o=[e,n,r,s];return i.forEach(function(e){t.handlers[e].push(o)}),t},replyOnce:function(n,r,s){var o=[e,n,r,s];return t.replyOnceHandlers.push(o),i.forEach(function(e){t.handlers[e].push(o)}),t}}},i.forEach(function(e){var t="on"+e.charAt(0).toUpperCase()+e.slice(1);o.prototype[t]=function(t){var n=this;return{reply:function(r,s,o){var a=[t,r,s,o];return n.handlers[e].push(a),n},replyOnce:function(r,s,o){var a=[t,r,s,o];return n.handlers[e].push(a),n.replyOnceHandlers.push(a),n}}}}),e.exports=o},function(e,t){"use strict";function n(e,t){for(var n=e.length,r=0;n>r;r++){var s=e[r];if(t(s))return s}}function r(e,t,r){return n(e[t.toLowerCase()],function(e){return"string"==typeof e[0]?r===e[0]:e[0]instanceof RegExp?e[0].test(r):void 0})}function s(e,t){var n=e.replyOnceHandlers.indexOf(t);n>-1&&(e.replyOnceHandlers.splice(n,1),Object.keys(e.handlers).forEach(function(r){n=e.handlers[r].indexOf(t),n>-1&&e.handlers[r].splice(n,1)}))}function o(e,t,n,r){return r>0?void setTimeout(function(){o(e,t,n)},r):n.config&&n.config.validateStatus?void(n.config.validateStatus(n.status)?e(n):t(n)):void(n.status>=200&&n.status<300?e(n):t(n))}e.exports={findHandler:r,purgeIfReplyOnce:s,settle:o}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AxiosMockAdapter=e():t.AxiosMockAdapter=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(){return function(t){return 3!==arguments.length?new Promise(function(e,r){s.call(this,e,r,t)}.bind(this)):void s.call(this,arguments[0],arguments[1],arguments[2])}.bind(this)}function o(){this.handlers=u.reduce(function(t,e){return t[e]=[],t},{}),this.replyOnceHandlers=[]}function i(t,e){o.call(this),t&&(this.axiosInstance=t,this.originalAdapter=t.defaults.adapter,this.delayResponse=e&&e.delayResponse>0?e.delayResponse:null,t.defaults.adapter=n.call(this))}var s=r(1),u=["get","post","head","delete","patch","put"];i.prototype.adapter=n,i.prototype.restore=function(){this.axiosInstance&&(this.axiosInstance.defaults.adapter=this.originalAdapter)},i.prototype.reset=o,i.prototype.onAny=function(t,e){var r=this;return{reply:function(n,o,i){var s=[t,n,o,i,e];return u.forEach(function(t){r.handlers[t].push(s)}),r},replyOnce:function(n,o,i){var s=[t,n,o,i,e];return r.replyOnceHandlers.push(s),u.forEach(function(t){r.handlers[t].push(s)}),r}}},u.forEach(function(t){var e="on"+t.charAt(0).toUpperCase()+t.slice(1);i.prototype[e]=function(e,r){var n=this;return{reply:function(o,i,s){var u=[e,o,i,s,r];return n.handlers[t].push(u),n},replyOnce:function(o,i,s){var u=[e,o,i,s,r];return n.handlers[t].push(u),n.replyOnceHandlers.push(u),n}}}}),t.exports=i},function(t,e,r){function n(t,e,r){var n=r.url.slice(r.baseURL?r.baseURL.length:0),i=o.findHandler(this.handlers,r.method,n,r.data);if(i){o.purgeIfReplyOnce(this,i);var s=i[1]instanceof Function?i[1](r):i.slice(1);o.settle(t,e,{status:s[0],data:s[1],headers:s[2],config:r},this.delayResponse)}else o.settle(t,e,{status:404,config:r},this.delayResponse)}var o=r(2);t.exports=n},function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=0;n<r;n++){var o=t[n];if(e(o))return o}}function o(t,e,r,o){return n(t[e.toLowerCase()],function(t){return"string"==typeof t[0]?r===t[0]&&i(o,t[4]):t[0]instanceof RegExp?t[0].test(r)&&i(o,t[4]):void 0})}function i(t,e){if(void 0===e)return!0;var r;try{r=JSON.parse(t)}catch(n){}return r?f(r,e):f(t,e)}function s(t,e){var r=t.replyOnceHandlers.indexOf(e);r>-1&&(t.replyOnceHandlers.splice(r,1),Object.keys(t.handlers).forEach(function(n){r=t.handlers[n].indexOf(e),r>-1&&t.handlers[n].splice(r,1)}))}function u(t,e,r,n){return n>0?void setTimeout(function(){u(t,e,r)},n):r.config&&r.config.validateStatus?void(r.config.validateStatus(r.status)?t(r):e(a("Request failed with status code "+r.status,r.config,r))):void(r.status>=200&&r.status<300?t(r):e(r))}function a(t,e,r){if(!h)return r;var n=new Error(t);return n.config=e,n.response=r,n}var f=r(3),c=r(11),h=!!c.create().defaults.headers;t.exports={findHandler:o,purgeIfReplyOnce:s,settle:u}},function(t,e,r){t.exports=r(4)},function(t,e,r){function n(t,e,r){return!!o(t,e)||("date"===g(t)?s(t,e):"regexp"===g(t)?u(t,e):d.isBuffer(t)?h(t,e):"arguments"===g(t)?a(t,e,r):!!i(t,e)&&("object"!==g(t)&&"object"!==g(e)&&"array"!==g(t)&&"array"!==g(e)?o(t,e):l(t,e,r)))}/*!
* Strict (egal) equality test. Ensures that NaN always
* equals NaN and `-0` does not equal `+0`.
*
* @param {Mixed} a
* @param {Mixed} b
* @return {Boolean} equal match
*/
function o(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e}/*!
* Compare the types of two given objects and
* return if they are equal. Note that an Array
* has a type of `array` (not `object`) and arguments
* have a type of `arguments` (not `array`/`object`).
*
* @param {Mixed} a
* @param {Mixed} b
* @return {Boolean} result
*/
function i(t,e){return g(t)===g(e)}/*!
* Compare two Date objects by asserting that
* the time values are equal using `saveValue`.
*
* @param {Date} a
* @param {Date} b
* @return {Boolean} result
*/
function s(t,e){return"date"===g(e)&&o(t.getTime(),e.getTime())}/*!
* Compare two regular expressions by converting them
* to string and checking for `sameValue`.
*
* @param {RegExp} a
* @param {RegExp} b
* @return {Boolean} result
*/
function u(t,e){return"regexp"===g(e)&&o(t.toString(),e.toString())}/*!
* Assert deep equality of two `arguments` objects.
* Unfortunately, these must be sliced to arrays
* prior to test to ensure no bad behavior.
*
* @param {Arguments} a
* @param {Arguments} b
* @param {Array} memoize (optional)
* @return {Boolean} result
*/
function a(t,e,r){return"arguments"===g(e)&&(t=[].slice.call(t),e=[].slice.call(e),n(t,e,r))}/*!
* Get enumerable properties of a given object.
*
* @param {Object} a
* @return {Array} property names
*/
function f(t){var e=[];for(var r in t)e.push(r);return e}/*!
* Simple equality for flat iterable objects
* such as Arrays or Node.js buffers.
*
* @param {Iterable} a
* @param {Iterable} b
* @return {Boolean} result
*/
function c(t,e){if(t.length!==e.length)return!1;for(var r=0,n=!0;r<t.length;r++)if(t[r]!==e[r]){n=!1;break}return n}/*!
* Extension to `iterableEqual` specifically
* for Node.js Buffers.
*
* @param {Buffer} a
* @param {Mixed} b
* @return {Boolean} result
*/
function h(t,e){return!!d.isBuffer(e)&&c(t,e)}/*!
* Block for `objectEqual` ensuring non-existing
* values don't get in.
*
* @param {Mixed} object
* @return {Boolean} result
*/
function p(t){return null!==t&&void 0!==t}/*!
* Recursively check the equality of two objects.
* Once basic sameness has been established it will
* defer to `deepEqual` for each enumerable key
* in the object.
*
* @param {Mixed} a
* @param {Mixed} b
* @return {Boolean} result
*/
function l(t,e,r){if(!p(t)||!p(e))return!1;if(t.prototype!==e.prototype)return!1;var o;if(r){for(o=0;o<r.length;o++)if(r[o][0]===t&&r[o][1]===e||r[o][0]===e&&r[o][1]===t)return!0}else r=[];try{var i=f(t),s=f(e)}catch(u){return!1}if(i.sort(),s.sort(),!c(i,s))return!1;r.push([t,e]);var a;for(o=i.length-1;o>=0;o--)if(a=i[o],!n(t[a],e[a],r))return!1;return!0}/*!
* deep-eql
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/*!
* Module dependencies
*/
var d,g=r(5);try{d=r(7).Buffer}catch(y){d={},d.isBuffer=function(){return!1}}/*!
* Primary Export
*/
t.exports=n},function(t,e,r){t.exports=r(6)},function(t,e){function r(t){var e=Object.prototype.toString.call(t);return o[e]?o[e]:null===t?"null":void 0===t?"undefined":t===Object(t)?"object":typeof t}function n(){this.tests={}}/*!
* type-detect
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
* MIT Licensed
*/
/*!
* Primary Exports
*/
var e=t.exports=r,o={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};e.Library=n,n.prototype.of=r,n.prototype.define=function(t,e){return 1===arguments.length?this.tests[t]:(this.tests[t]=e,this)},n.prototype.test=function(t,e){if(e===r(t))return!0;var n=this.tests[e];if(n&&"regexp"===r(n))return n.test(t);if(n&&"function"===r(n))return n(t);throw new ReferenceError('Type test "'+e+'" not defined or invalid.')}},function(t,e,r){(function(t,n){/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
"use strict";function o(){function t(){}try{var e=new Uint8Array(1);return e.foo=function(){return 42},e.constructor=t,42===e.foo()&&e.constructor===t&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(r){return!1}}function i(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function t(e){return this instanceof t?(t.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof e?s(this,e):"string"==typeof e?u(this,e,arguments.length>1?arguments[1]:"utf8"):a(this,e)):arguments.length>1?new t(e,arguments[1]):new t(e)}function s(e,r){if(e=g(e,r<0?0:0|y(r)),!t.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;n++)e[n]=0;return e}function u(t,e,r){"string"==typeof r&&""!==r||(r="utf8");var n=0|v(e,r);return t=g(t,n),t.write(e,r),t}function a(e,r){if(t.isBuffer(r))return f(e,r);if(G(r))return c(e,r);if(null==r)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(r.buffer instanceof ArrayBuffer)return h(e,r);if(r instanceof ArrayBuffer)return p(e,r)}return r.length?l(e,r):d(e,r)}function f(t,e){var r=0|y(e.length);return t=g(t,r),e.copy(t,0,0,r),t}function c(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(e,r){return t.TYPED_ARRAY_SUPPORT?(r.byteLength,e=t._augment(new Uint8Array(r))):e=h(e,new Uint8Array(r)),e}function l(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function d(t,e){var r,n=0;"Buffer"===e.type&&G(e.data)&&(r=e.data,n=0|y(r.length)),t=g(t,n);for(var o=0;o<n;o+=1)t[o]=255&r[o];return t}function g(e,r){t.TYPED_ARRAY_SUPPORT?(e=t._augment(new Uint8Array(r)),e.__proto__=t.prototype):(e.length=r,e._isBuffer=!0);var n=0!==r&&r<=t.poolSize>>>1;return n&&(e.parent=Z),e}function y(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function w(e,r){if(!(this instanceof w))return new w(e,r);var n=new t(e,r);return delete n.parent,n}function v(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return H(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(t).length;default:if(n)return H(t).length;e=(""+e).toLowerCase(),n=!0}}function E(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),e<0&&(e=0),r>this.length&&(r=this.length),r<=e)return"";for(;;)switch(t){case"hex":return L(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return T(this,e,r);case"binary":return P(this,e,r);case"base64":return U(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var i=e.length;if(i%2!==0)throw new Error("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;s++){var u=parseInt(e.substr(2*s,2),16);if(isNaN(u))throw new Error("Invalid hex string");t[r+s]=u}return s}function A(t,e,r,n){return V(H(e,t.length-r),t,r,n)}function R(t,e,r,n){return V(X(e),t,r,n)}function b(t,e,r,n){return R(t,e,r,n)}function B(t,e,r,n){return V(J(e),t,r,n)}function I(t,e,r,n){return V(z(e,t.length-r),t,r,n)}function U(t,e,r){return 0===e&&r===t.length?$.fromByteArray(t):$.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i=t[o],s=null,u=i>239?4:i>223?3:i>191?2:1;if(o+u<=r){var a,f,c,h;switch(u){case 1:i<128&&(s=i);break;case 2:a=t[o+1],128===(192&a)&&(h=(31&i)<<6|63&a,h>127&&(s=h));break;case 3:a=t[o+1],f=t[o+2],128===(192&a)&&128===(192&f)&&(h=(15&i)<<12|(63&a)<<6|63&f,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:a=t[o+1],f=t[o+2],c=t[o+3],128===(192&a)&&128===(192&f)&&128===(192&c)&&(h=(15&i)<<18|(63&a)<<12|(63&f)<<6|63&c,h>65535&&h<1114112&&(s=h))}}null===s?(s=65533,u=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=u}return S(n)}function S(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Q));return r}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;o++)n+=String.fromCharCode(127&t[o]);return n}function P(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;o++)n+=String.fromCharCode(t[o]);return n}function L(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;i++)o+=q(t[i]);return o}function _(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function O(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function C(e,r,n,o,i,s){if(!t.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(r>i||r<s)throw new RangeError("value is out of bounds");if(n+o>e.length)throw new RangeError("index out of range")}function D(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;o++)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function Y(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;o++)t[r+o]=e>>>8*(n?o:3-o)&255}function j(t,e,r,n,o,i){if(e>o||e<i)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range");if(r<0)throw new RangeError("index out of range")}function M(t,e,r,n,o){return o||j(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,o){return o||j(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,r,n,52,8),r+8}function F(t){if(t=k(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function k(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function H(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],s=0;s<n;s++){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function X(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e}function z(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);s++)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function J(t){return $.toByteArray(F(t))}function V(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);o++)e[o+r]=t[o];return o}var $=r(8),K=r(9),G=r(10);e.Buffer=t,e.SlowBuffer=w,e.INSPECT_MAX_BYTES=50,t.poolSize=8192;var Z={};t.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:o(),t.TYPED_ARRAY_SUPPORT?(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array):(t.prototype.length=void 0,t.prototype.parent=void 0),t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,o=r.length,i=0,s=Math.min(n,o);i<s&&e[i]===r[i];)++i;return i!==s&&(n=e[i],o=r[i]),n<o?-1:o<n?1:0},t.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,r){if(!G(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new t(0);var n;if(void 0===r)for(r=0,n=0;n<e.length;n++)r+=e[n].length;var o=new t(r),i=0;for(n=0;n<e.length;n++){var s=e[n];s.copy(o,i),i+=s.length}return o},t.byteLength=v,t.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?x(this,0,t):E.apply(this,arguments)},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},t.prototype.compare=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:t.compare(this,e)},t.prototype.indexOf=function(e,r){function n(t,e,r){for(var n=-1,o=0;r+o<t.length;o++)if(t[r+o]===e[n===-1?0:o-n]){if(n===-1&&(n=o),o-n+1===e.length)return r+n}else n=-1;return-1}if(r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r>>=0,0===this.length)return-1;if(r>=this.length)return-1;if(r<0&&(r=Math.max(this.length+r,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,r);if(t.isBuffer(e))return n(this,e,r);if("number"==typeof e)return t.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,r):n(this,[e],r);throw new TypeError("val must be string, number or Buffer")},t.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},t.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},t.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var o=n;n=e,e=0|r,r=o}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":return R(this,t,e,r);case"binary":return b(this,t,e,r);case"base64":return B(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var o;if(t.TYPED_ARRAY_SUPPORT)o=t._augment(this.subarray(e,r));else{var i=r-e;o=new t(i,(void 0));for(var s=0;s<i;s++)o[s]=this[s+e]}return o.length&&(o.parent=this.parent||this),o},t.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||O(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},t.prototype.readUIntBE=function(t,e,r){t=0|t,e=0|e,r||O(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},t.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||O(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||O(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},t.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),K.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),K.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),K.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),K.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||C(this,t,e,r,Math.pow(2,8*r),0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},t.prototype.writeUIntBE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||C(this,t,e,r,Math.pow(2,8*r),0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},t.prototype.writeUInt8=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},t.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):D(this,e,r,!0),r+2},t.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):D(this,e,r,!1),r+2},t.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):Y(this,e,r,!0),r+4},t.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):Y(this,e,r,!1),r+4},t.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var o=Math.pow(2,8*r-1);C(this,t,e,r,o-1,-o)}var i=0,s=1,u=t<0?1:0;for(this[e]=255&t;++i<r&&(s*=256);)this[e+i]=(t/s>>0)-u&255;return e+r},t.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var o=Math.pow(2,8*r-1);C(this,t,e,r,o-1,-o)}var i=r-1,s=1,u=t<0?1:0;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=(t/s>>0)-u&255;return e+r},t.prototype.writeInt8=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=255&e,r+1},t.prototype.writeInt16LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):D(this,e,r,!0),r+2},t.prototype.writeInt16BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):D(this,e,r,!1),r+2},t.prototype.writeInt32LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):Y(this,e,r,!0),r+4},t.prototype.writeInt32BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):Y(this,e,r,!1),r+4},t.prototype.writeFloatLE=function(t,e,r){return M(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return M(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},t.prototype.copy=function(e,r,n,o){if(n||(n=0),o||0===o||(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===n)return 0;if(0===e.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);var i,s=o-n;if(this===e&&n<r&&r<o)for(i=s-1;i>=0;i--)e[i+r]=this[i+n];else if(s<1e3||!t.TYPED_ARRAY_SUPPORT)for(i=0;i<s;i++)e[i+r]=this[i+n];else e._set(this.subarray(n,n+s),r);return s},t.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),r<e)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(e<0||e>=this.length)throw new RangeError("start out of bounds");if(r<0||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;n<r;n++)this[n]=t;else{var o=H(t.toString()),i=o.length;for(n=e;n<r;n++)this[n]=o[n%i]}return this}},t.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(t.TYPED_ARRAY_SUPPORT)return new t(this).buffer;for(var e=new Uint8Array(this.length),r=0,n=e.length;r<n;r+=1)e[r]=this[r];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var W=t.prototype;t._augment=function(e){return e.constructor=t,e._isBuffer=!0,e._set=e.set,e.get=W.get,e.set=W.set,e.write=W.write,e.toString=W.toString,e.toLocaleString=W.toString,e.toJSON=W.toJSON,e.equals=W.equals,e.compare=W.compare,e.indexOf=W.indexOf,e.copy=W.copy,e.slice=W.slice,e.readUIntLE=W.readUIntLE,e.readUIntBE=W.readUIntBE,e.readUInt8=W.readUInt8,e.readUInt16LE=W.readUInt16LE,e.readUInt16BE=W.readUInt16BE,e.readUInt32LE=W.readUInt32LE,e.readUInt32BE=W.readUInt32BE,e.readIntLE=W.readIntLE,e.readIntBE=W.readIntBE,e.readInt8=W.readInt8,e.readInt16LE=W.readInt16LE,e.readInt16BE=W.readInt16BE,e.readInt32LE=W.readInt32LE,e.readInt32BE=W.readInt32BE,e.readFloatLE=W.readFloatLE,e.readFloatBE=W.readFloatBE,e.readDoubleLE=W.readDoubleLE,e.readDoubleBE=W.readDoubleBE,e.writeUInt8=W.writeUInt8,e.writeUIntLE=W.writeUIntLE,e.writeUIntBE=W.writeUIntBE,e.writeUInt16LE=W.writeUInt16LE,e.writeUInt16BE=W.writeUInt16BE,e.writeUInt32LE=W.writeUInt32LE,e.writeUInt32BE=W.writeUInt32BE,e.writeIntLE=W.writeIntLE,e.writeIntBE=W.writeIntBE,e.writeInt8=W.writeInt8,e.writeInt16LE=W.writeInt16LE,e.writeInt16BE=W.writeInt16BE,e.writeInt32LE=W.writeInt32LE,e.writeInt32BE=W.writeInt32BE,e.writeFloatLE=W.writeFloatLE,e.writeFloatBE=W.writeFloatBE,e.writeDoubleLE=W.writeDoubleLE,e.writeDoubleBE=W.writeDoubleBE,e.fill=W.fill,e.inspect=W.inspect,e.toArrayBuffer=W.toArrayBuffer,e};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,r(7).Buffer,function(){return this}())},function(t,e,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===s||e===h?62:e===u||e===p?63:e<a?-1:e<a+10?e-a+26+26:e<c+26?e-c:e<f+26?e-f+26:void 0}function r(t){function r(t){f[h++]=t}var n,o,s,u,a,f;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=t.length;a="="===t.charAt(c-2)?2:"="===t.charAt(c-1)?1:0,f=new i(3*t.length/4-a),s=a>0?t.length-4:t.length;var h=0;for(n=0,o=0;n<s;n+=4,o+=3)u=e(t.charAt(n))<<18|e(t.charAt(n+1))<<12|e(t.charAt(n+2))<<6|e(t.charAt(n+3)),r((16711680&u)>>16),r((65280&u)>>8),r(255&u);return 2===a?(u=e(t.charAt(n))<<2|e(t.charAt(n+1))>>4,r(255&u)):1===a&&(u=e(t.charAt(n))<<10|e(t.charAt(n+1))<<4|e(t.charAt(n+2))>>2,r(u>>8&255),r(255&u)),f}function o(t){function e(t){return n.charAt(t)}function r(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var o,i,s,u=t.length%3,a="";for(o=0,s=t.length-u;o<s;o+=3)i=(t[o]<<16)+(t[o+1]<<8)+t[o+2],a+=r(i);switch(u){case 1:i=t[t.length-1],a+=e(i>>2),a+=e(i<<4&63),a+="==";break;case 2:i=(t[t.length-2]<<8)+t[t.length-1],a+=e(i>>10),a+=e(i>>4&63),a+=e(i<<2&63),a+="="}return a}var i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),u="/".charCodeAt(0),a="0".charCodeAt(0),f="a".charCodeAt(0),c="A".charCodeAt(0),h="-".charCodeAt(0),p="_".charCodeAt(0);t.toByteArray=r,t.fromByteArray=o}(e)},function(t,e){e.read=function(t,e,r,n,o){var i,s,u=8*o-n-1,a=(1<<u)-1,f=a>>1,c=-7,h=r?o-1:0,p=r?-1:1,l=t[e+h];for(h+=p,i=l&(1<<-c)-1,l>>=-c,c+=u;c>0;i=256*i+t[e+h],h+=p,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=p,c-=8);if(0===i)i=1-f;else{if(i===a)return s?NaN:(l?-1:1)*(1/0);s+=Math.pow(2,n),i-=f}return(l?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,u,a,f=8*i-o-1,c=(1<<f)-1,h=c>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:i-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),e+=s+h>=1?p/a:p*Math.pow(2,1-h),e*a>=2&&(s++,a/=2),s+h>=c?(u=0,s=c):s+h>=1?(u=(e*a-1)*Math.pow(2,o),s+=h):(u=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[r+l]=255&u,l+=d,u/=256,o-=8);for(s=s<<o|u,f+=o;f>0;t[r+l]=255&s,l+=d,s/=256,f-=8);t[r+l-d]|=128*g}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){t.exports=r(12)},function(t,e,r){"use strict";function n(t){var e=new s(t),r=i(s.prototype.request,e);return o.extend(r,s.prototype,e),o.extend(r,e),r}var o=r(13),i=r(14),s=r(15),u=t.exports=n();u.Axios=s,u.create=function(t){return n(t)},u.all=function(t){return Promise.all(t)},u.spread=r(33)},function(t,e,r){"use strict";function n(t){return"[object Array]"===b.call(t)}function o(t){return"[object ArrayBuffer]"===b.call(t)}function i(t){return"undefined"!=typeof FormData&&t instanceof FormData}function s(t){var e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function u(t){return"string"==typeof t}function a(t){return"number"==typeof t}function f(t){return"undefined"==typeof t}function c(t){return null!==t&&"object"==typeof t}function h(t){return"[object Date]"===b.call(t)}function p(t){return"[object File]"===b.call(t)}function l(t){return"[object Blob]"===b.call(t)}function d(t){return"[object Function]"===b.call(t)}function g(t){return c(t)&&d(t.pipe)}function y(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams}function w(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function v(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function E(t,e){if(null!==t&&"undefined"!=typeof t)if("object"==typeof t||n(t)||(t=[t]),n(t))for(var r=0,o=t.length;r<o;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 m(){function t(t,r){"object"==typeof e[r]&&"object"==typeof t?e[r]=m(e[r],t):e[r]=t}for(var e={},r=0,n=arguments.length;r<n;r++)E(arguments[r],t);return e}function A(t,e,r){return E(e,function(e,n){r&&"function"==typeof e?t[n]=R(e,r):t[n]=e}),t}var R=r(14),b=Object.prototype.toString;t.exports={isArray:n,isArrayBuffer:o,isFormData:i,isArrayBufferView:s,isString:u,isNumber:a,isObject:c,isUndefined:f,isDate:h,isFile:p,isBlob:l,isFunction:d,isStream:g,isURLSearchParams:y,isStandardBrowserEnv:v,forEach:E,merge:m,extend:A,trim:w}},function(t,e){"use strict";t.exports=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}}},function(t,e,r){"use strict";function n(t){this.defaults=i.merge(o,t),this.interceptors={request:new s,response:new s}}var o=r(16),i=r(13),s=r(18),u=r(19),a=r(31),f=r(32);n.prototype.request=function(t){"string"==typeof t&&(t=i.merge({url:arguments[0]},arguments[1])),t=i.merge(o,this.defaults,{method:"get"},t),t.baseURL&&!a(t.url)&&(t.url=f(t.baseURL,t.url));var e=[u,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)r=r.then(e.shift(),e.shift());return r},i.forEach(["delete","get","head"],function(t){n.prototype[t]=function(e,r){return this.request(i.merge(r||{},{method:t,url:e}))}}),i.forEach(["post","put","patch"],function(t){n.prototype[t]=function(e,r,n){return this.request(i.merge(n||{},{method:t,url:e,data:r}))}}),t.exports=n},function(t,e,r){"use strict";function n(t,e){!o.isUndefined(t)&&o.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var o=r(13),i=r(17),s=/^\)\]\}',?\n/,u={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,e){return i(e,"Content-Type"),o.isFormData(t)||o.isArrayBuffer(t)||o.isStream(t)||o.isFile(t)||o.isBlob(t)?t:o.isArrayBufferView(t)?t.buffer:o.isURLSearchParams(t)?(n(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):o.isObject(t)?(n(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t){t=t.replace(s,"");try{t=JSON.parse(t)}catch(e){}}return t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:o.merge(u),post:o.merge(u),put:o.merge(u)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}}},function(t,e,r){"use strict";var n=r(13);t.exports=function(t,e){n.forEach(t,function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])})}},function(t,e,r){"use strict";function n(){this.handlers=[]}var o=r(13);n.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},n.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},n.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=n},function(t,e,r){(function(e){"use strict";var n=r(13),o=r(21);t.exports=function(t){t.headers=t.headers||{},t.data=o(t.data,t.headers,t.transformRequest),t.headers=n.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]});var i;return"function"==typeof t.adapter?i=t.adapter:"undefined"!=typeof XMLHttpRequest?i=r(22):"undefined"!=typeof e&&(i=r(22)),Promise.resolve(t).then(i).then(function(e){return e.data=o(e.data,e.headers,t.transformResponse),e},function(e){return e&&e.response&&(e.response.data=o(e.response.data,e.response.headers,t.transformResponse)),Promise.reject(e)})}}).call(e,r(20))},function(t,e){function r(){h&&f&&(h=!1,f.length?c=f.concat(c):p=-1,c.length&&n())}function n(){if(!h){var t=s(r);h=!0;for(var e=c.length;e;){for(f=c,c=[];++p<e;)f&&f[p].run();p=-1,e=c.length}f=null,h=!1,u(t)}}function o(t,e){this.fun=t,this.array=e}function i(){}var s,u,a=t.exports={};!function(){try{s=setTimeout}catch(t){s=function(){throw new Error("setTimeout is not defined")}}try{u=clearTimeout}catch(t){u=function(){throw new Error("clearTimeout is not defined")}}}();var f,c=[],h=!1,p=-1;a.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new o(t,e)),1!==c.length||h||s(n,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=i,a.addListener=i,a.once=i,a.off=i,a.removeListener=i,a.removeAllListeners=i,a.emit=i,a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(t,e,r){"use strict";var n=r(13);t.exports=function(t,e,r){return n.forEach(r,function(r){t=r(t,e)}),t}},function(t,e,r){(function(e){"use strict";var n=r(13),o=r(23),i=r(26),s=r(27),u=r(28),a=r(24),f="undefined"!=typeof window&&window.btoa||r(29);t.exports=function(t){return new Promise(function(c,h){var p=t.data,l=t.headers;n.isFormData(p)&&delete l["Content-Type"];var d=new XMLHttpRequest,g="onreadystatechange",y=!1;if("test"===e.env.NODE_ENV||"undefined"==typeof window||!window.XDomainRequest||"withCredentials"in d||u(t.url)||(d=new window.XDomainRequest,g="onload",y=!0,d.onprogress=function(){},d.ontimeout=function(){}),t.auth){var w=t.auth.username||"",v=t.auth.password||"";l.Authorization="Basic "+f(w+":"+v)}if(d.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),d.timeout=t.timeout,d[g]=function(){if(d&&(4===d.readyState||y)&&0!==d.status){var e="getAllResponseHeaders"in d?s(d.getAllResponseHeaders()):null,r=t.responseType&&"text"!==t.responseType?d.response:d.responseText,n={data:r,status:1223===d.status?204:d.status,statusText:1223===d.status?"No Content":d.statusText,headers:e,config:t,request:d};o(c,h,n),d=null}},d.onerror=function(){h(a("Network Error",t)),d=null},d.ontimeout=function(){h(a("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED")),d=null},n.isStandardBrowserEnv()){var E=r(30),m=t.withCredentials||u(t.url)?E.read(t.xsrfCookieName):void 0;m&&(l[t.xsrfHeaderName]=m)}if("setRequestHeader"in d&&n.forEach(l,function(t,e){"undefined"==typeof p&&"content-type"===e.toLowerCase()?delete l[e]:d.setRequestHeader(e,t)}),t.withCredentials&&(d.withCredentials=!0),t.responseType)try{d.responseType=t.responseType}catch(A){if("json"!==d.responseType)throw A}"function"==typeof t.progress&&("post"===t.method||"put"===t.method?d.upload.addEventListener("progress",t.progress):"get"===t.method&&d.addEventListener("progress",t.progress)),void 0===p&&(p=null),d.send(p)})}}).call(e,r(20))},function(t,e,r){"use strict";var n=r(24);t.exports=function(t,e,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?e(n("Request failed with status code "+r.status,r.config,null,r)):t(r)}},function(t,e,r){"use strict";var n=r(25);t.exports=function(t,e,r,o){var i=new Error(t);return n(i,e,r,o)}},function(t,e){"use strict";t.exports=function(t,e,r,n){return t.config=e,r&&(t.code=r),t.response=n,t}},function(t,e,r){"use strict";function n(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=r(13);t.exports=function(t,e,r){if(!e)return t;var i;if(r)i=r(e);else if(o.isURLSearchParams(e))i=e.toString();else{var s=[];o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)&&(e+="[]"),o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),s.push(n(e)+"="+n(t))}))}),i=s.join("&")}return i&&(t+=(t.indexOf("?")===-1?"?":"&")+i),t}},function(t,e,r){"use strict";var n=r(13);t.exports=function(t){var e,r,o,i={};return t?(n.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=n.trim(t.substr(0,o)).toLowerCase(),r=n.trim(t.substr(o+1)),e&&(i[e]=i[e]?i[e]+", "+r:r)}),i):i}},function(t,e,r){"use strict";var n=r(13);t.exports=n.isStandardBrowserEnv()?function(){function t(t){var e=t;return r&&(o.setAttribute("href",e),e=o.href),o.setAttribute("href",e),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var e,r=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return e=t(window.location.href),function(r){var o=n.isString(r)?t(r):r;return o.protocol===e.protocol&&o.host===e.host}}():function(){return function(){return!0}}()},function(t,e){"use strict";function r(){this.message="String contains an invalid character"}function n(t){for(var e,n,i=String(t),s="",u=0,a=o;i.charAt(0|u)||(a="=",u%1);s+=a.charAt(63&e>>8-u%1*8)){if(n=i.charCodeAt(u+=.75),n>255)throw new r;e=e<<8|n}return s}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",t.exports=n},function(t,e,r){"use strict";var n=r(13);t.exports=n.isStandardBrowserEnv()?function(){return{write:function(t,e,r,o,i,s){var u=[];u.push(t+"="+encodeURIComponent(e)),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(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(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(t,e){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e){"use strict";t.exports=function(t,e){return t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,"")}},function(t,e){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}}])});

12

package.json
{
"name": "axios-mock-adapter",
"version": "1.5.0",
"version": "1.6.0",
"description": "Axios adapter that allows to easily mock requests",

@@ -36,10 +36,16 @@ "main": "src/index.js",

"homepage": "https://github.com/ctimmerm/axios-mock-adapter#readme",
"peerDependencies": {
"axios": ">= 0.9.0"
},
"devDependencies": {
"axios": "^0.12.0",
"axios": "^0.13.1",
"chai": "^3.5.0",
"eslint": "^2.13.1",
"eslint": "^3.0.1",
"mocha": "^2.4.5",
"rimraf": "^2.5.2",
"webpack": "^1.12.15"
},
"dependencies": {
"deep-eql": "^0.1.3"
}
}
'use strict';
var utils = require('./utils');
var handleRequest = require('./handle_request');

@@ -8,23 +8,11 @@ var verbs = ['get', 'post', 'head', 'delete', 'patch', 'put'];

function adapter() {
return function(resolve, reject, config) {
var url = config.url.slice(config.baseURL ? config.baseURL.length : 0);
var handler = utils.findHandler(this.handlers, config.method, url);
if (handler) {
utils.purgeIfReplyOnce(this, handler);
var response = handler[1] instanceof Function
? handler[1](config)
: handler.slice(1);
utils.settle(resolve, reject, {
status: response[0],
data: response[1],
headers: response[2],
config: config
}, this.delayResponse);
return function(config) {
// axios >= 0.13.0 only passes the config and expects a promise to be
// returned. axios < 0.13.0 passes (config, resolve, reject).
if (arguments.length === 3) {
handleRequest.call(this, arguments[0], arguments[1], arguments[2]);
} else {
utils.settle(resolve, reject, {
status: 404,
config: config
}, this.delayResponse);
return new Promise(function(resolve, reject) {
handleRequest.call(this, resolve, reject, config);
}.bind(this));
}

@@ -65,7 +53,7 @@ }.bind(this);

MockAdapter.prototype.onAny = function onAny(matcher) {
MockAdapter.prototype.onAny = function onAny(matcher, body) {
var _this = this;
return {
reply: function reply(code, response, headers) {
var handler = [matcher, code, response, headers];
var handler = [matcher, code, response, headers, body];
verbs.forEach(function(verb) {

@@ -78,3 +66,3 @@ _this.handlers[verb].push(handler);

replyOnce: function replyOnce(code, response, headers) {
var handler = [matcher, code, response, headers];
var handler = [matcher, code, response, headers, body];
_this.replyOnceHandlers.push(handler);

@@ -91,7 +79,7 @@ verbs.forEach(function(verb) {

var methodName = 'on' + method.charAt(0).toUpperCase() + method.slice(1);
MockAdapter.prototype[methodName] = function(matcher) {
MockAdapter.prototype[methodName] = function(matcher, body) {
var _this = this;
return {
reply: function reply(code, response, headers) {
var handler = [matcher, code, response, headers];
var handler = [matcher, code, response, headers, body];
_this.handlers[method].push(handler);

@@ -102,3 +90,3 @@ return _this;

replyOnce: function replyOnce(code, response, headers) {
var handler = [matcher, code, response, headers];
var handler = [matcher, code, response, headers, body];
_this.handlers[method].push(handler);

@@ -105,0 +93,0 @@ _this.replyOnceHandlers.push(handler);

'use strict';
var eql = require('deep-eql');
var axios = require('axios');
// < 0.13.0 will not have default headers set on a custom instance
var rejectWithError = !!axios.create().defaults.headers;
function find(array, predicate) {

@@ -11,8 +16,8 @@ var length = array.length;

function findHandler(handlers, method, url) {
function findHandler(handlers, method, url, body) {
return find(handlers[method.toLowerCase()], function(handler) {
if (typeof handler[0] === 'string') {
return url === handler[0];
return url === handler[0] && isBodyMatching(body, handler[4]);
} else if (handler[0] instanceof RegExp) {
return handler[0].test(url);
return handler[0].test(url) && isBodyMatching(body, handler[4]);
}

@@ -22,2 +27,13 @@ });

function isBodyMatching(body, requiredBody) {
if (requiredBody === undefined) {
return true;
}
var parsedBody;
try {
parsedBody = JSON.parse(body);
} catch (e) { }
return parsedBody ? eql(parsedBody, requiredBody) : eql(body, requiredBody);
}
function purgeIfReplyOnce(mock, handler) {

@@ -48,3 +64,7 @@ var index = mock.replyOnceHandlers.indexOf(handler);

? resolve(response)
: reject(response);
: reject(createErrorResponse(
'Request failed with status code ' + response.status,
response.config,
response
));
return;

@@ -61,2 +81,12 @@ }

function createErrorResponse(message, config, response) {
// Support for axios < 0.13.0
if (!rejectWithError) return response;
var error = new Error(message);
error.config = config;
error.response = response;
return error;
}
module.exports = {

@@ -63,0 +93,0 @@ findHandler: findHandler,

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc