axios-mock-adapter
Advanced tools
Comparing version 1.20.0 to 1.21.0
/*! For license information please see axios-mock-adapter.min.js.LICENSE.txt */ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios")):"function"==typeof define&&define.amd?define(["axios"],t):"object"==typeof exports?exports.AxiosMockAdapter=t(require("axios")):e.AxiosMockAdapter=t(e.axios)}(self,(function(e){return t={63:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!=o--;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}},456:e=>{"use strict";e.exports=e=>"undefined"!=typeof Blob&&(e instanceof Blob||"[object Blob]"===Object.prototype.toString.call(e))},738:e=>{e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},141:(e,t,r)=>{"use strict";var n=r(555);function o(e,t){return{status:e[0],data:(r=e[1],n.isArrayBuffer(r)||n.isBuffer(r)||n.isStream(r)||n.isBlob(r)?r:n.isObjectOrArray(r)?JSON.parse(JSON.stringify(r)):r),headers:e[2],config:t,request:{responseURL:t.url}};var r}e.exports=function(e,t,r,i){var s=i.url||"";i.baseURL&&s.substr(0,i.baseURL.length)===i.baseURL&&(s=s.slice(i.baseURL.length)),delete i.adapter,e.history[i.method].push(i);var u=n.findHandler(e.handlers,i.method,s,i.data,i.params,i.headers,i.baseURL);if(u)if(7===u.length&&n.purgeIfReplyOnce(e,u),2===u.length)e.originalAdapter(i).then(t,r);else if("function"!=typeof u[3])n.settle(t,r,o(u.slice(3),i),e.delayResponse);else{var a=u[3](i);"function"!=typeof a.then?n.settle(t,r,o(a,i),e.delayResponse):a.then((function(s){s.config&&s.status?n.settle(t,r,o([s.status,s.data,s.headers],s.config),0):n.settle(t,r,o(s,i),e.delayResponse)}),(function(t){e.delayResponse>0?setTimeout((function(){r(t)}),e.delayResponse):r(t)}))}else switch(e.onNoMatch){case"passthrough":e.originalAdapter(i).then(t,r);break;case"throwException":throw n.createCouldNotFindMockError(i);default:n.settle(t,r,{status:404,config:i},e.delayResponse)}}},138:(e,t,r)=>{"use strict";var n=r(141),o=r(555),i=["get","post","head","delete","patch","put","options","list"];function s(){return i.reduce((function(e,t){return e[t]=[],e}),{})}function u(){a.call(this),c.call(this)}function a(){this.handlers=s()}function c(){this.history=s()}function f(e,t){if(u.call(this),!e)throw new Error("Please provide an instance of axios to mock");this.axiosInstance=e,this.originalAdapter=e.defaults.adapter,this.delayResponse=t&&t.delayResponse>0?t.delayResponse:null,this.onNoMatch=t&&t.onNoMatch||null,e.defaults.adapter=this.adapter.call(this)}function l(e,t,r){if("any"===e)i.forEach((function(e){t[e].push(r)}));else{var n=function(e,t,r){for(var n=-1,i=0;i<t[e].length;i+=1){var s=t[e][i],u=7===s.length;(s[0]instanceof RegExp&&r[0]instanceof RegExp?String(s[0])===String(r[0]):s[0]===r[0])&&o.isEqual(s[1],r[1])&&o.isEqual(s[2],r[2])&&!u&&(n=i)}return n}(e,t,r);n>-1&&r.length<7?t[e].splice(n,1,r):t[e].push(r)}}f.prototype.adapter=function(){return function(e){var t=this;if(3!==arguments.length)return new Promise((function(r,o){n(t,r,o,e)}));n(t,arguments[0],arguments[1],arguments[2])}.bind(this)},f.prototype.restore=function(){this.axiosInstance&&(this.axiosInstance.defaults.adapter=this.originalAdapter,this.axiosInstance=void 0)},f.prototype.reset=u,f.prototype.resetHandlers=a,f.prototype.resetHistory=c,i.concat("any").forEach((function(e){var t="on"+e.charAt(0).toUpperCase()+e.slice(1);f.prototype[t]=function(t,r,n){var i=this;function s(o,s,u){var a=[t,r,n,o,s,u];return l(e,i.handlers,a),i}function u(o,s,u){var a=[t,r,n,o,s,u,!0];return l(e,i.handlers,a),i}return t=void 0===t?/.*/:t,{reply:s,replyOnce:u,passThrough:function(){var n=[t,r];return l(e,i.handlers,n),i},abortRequest:function(){return s((function(e){var t=o.createAxiosError("Request aborted",e,void 0,"ECONNABORTED");return Promise.reject(t)}))},abortRequestOnce:function(){return u((function(e){var t=o.createAxiosError("Request aborted",e,void 0,"ECONNABORTED");return Promise.reject(t)}))},networkError:function(){return s((function(e){var t=o.createAxiosError("Network Error",e);return Promise.reject(t)}))},networkErrorOnce:function(){return u((function(e){var t=o.createAxiosError("Network Error",e);return Promise.reject(t)}))},timeout:function(){return s((function(e){var t=o.createAxiosError(e.timeoutErrorMessage||"timeout of "+e.timeout+"ms exceeded",e,void 0,"ECONNABORTED");return Promise.reject(t)}))},timeoutOnce:function(){return u((function(e){var t=o.createAxiosError(e.timeoutErrorMessage||"timeout of "+e.timeout+"ms exceeded",e,void 0,"ECONNABORTED");return Promise.reject(t)}))}}}})),e.exports=f,e.exports.default=f},555:(e,t,r)=>{"use strict";var n=r(376),o=r(63),i=r(738),s=r(456),u=Object.prototype.toString,a=!!n.create().defaults.headers;function c(e,t){for(var r=e.length,n=0;n<r;n++){var o=e[n];if(t(o))return o}}function f(e){return"[object Function]"===u.call(e)}function l(e){return null!==e&&"object"==typeof e}function p(e,t){return e?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):t}function d(e,t){return("/"===e[0]?e.substr(1):e)===("/"===t[0]?t.substr(1):t)}function h(e,t,r,n){return["delete","get","head","options"].indexOf(e.toLowerCase())>=0?y(r,n?n.params:void 0):function(e,t){if(void 0===t)return!0;var r;try{r=JSON.parse(e)}catch(e){}return y(r||e,t)}(t,n)}function y(e,t){return void 0===t||("function"==typeof t.asymmetricMatch?t.asymmetricMatch(e):o(e,t))}function g(e,t,r,n){var o=new Error(e);return o.isAxiosError=!0,o.config=t,void 0!==r&&(o.response=r),void 0!==n&&(o.code=n),o.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},o}e.exports={find:c,findHandler:function(e,t,r,n,o,i,s){return c(e[t.toLowerCase()],(function(e){return"string"==typeof e[0]?(d(r,e[0])||d(p(s,r),e[0]))&&h(t,n,o,e[1])&&y(i,e[2]):e[0]instanceof RegExp?(e[0].test(r)||e[0].test(p(s,r)))&&h(t,n,o,e[1])&&y(i,e[2]):void 0}))},purgeIfReplyOnce:function(e,t){Object.keys(e.handlers).forEach((function(r){var n=e.handlers[r].indexOf(t);n>-1&&e.handlers[r].splice(n,1)}))},settle:function e(t,r,n,o){if(o>0)setTimeout(e,o,t,r,n);else if(a||n.config&&n.config.validateStatus)if(!n.config.validateStatus||n.config.validateStatus(n.status))t(n);else{if(!a)return r(n);r(g("Request failed with status code "+n.status,n.config,n))}else n.status>=200&&n.status<300?t(n):r(n)},isStream:function(e){return l(e)&&f(e.pipe)},isArrayBuffer:function(e){return"[object ArrayBuffer]"===u.call(e)},isFunction:f,isObjectOrArray:l,isBuffer:i,isBlob:s,isEqual:o,createAxiosError:g,createCouldNotFindMockError:function(e){var t="Could not find mock for: \n"+JSON.stringify(e,["method","url"],2),r=new Error(t);return r.isCouldNotFindMockError=!0,r.url=e.url,r.method=e.method,r}}},376:t=>{"use strict";t.exports=e}},r={},function e(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return t[n](i,i.exports,e),i.exports}(138);var t,r})); | ||
!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()}(self,(()=>{return e={63:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!=o--;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}},738:e=>{e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},141:(e,t,r)=>{"use strict";var n=r(555);function o(e,t){return{status:e[0],data:(r=e[1],n.isArrayBuffer(r)||n.isBuffer(r)||n.isStream(r)||n.isBlob(r)?r:n.isObjectOrArray(r)?JSON.parse(JSON.stringify(r)):r),headers:e[2],config:t,request:{responseURL:t.url}};var r}e.exports=function(e,t,r,i){var s=i.url||"";i.baseURL&&s.substr(0,i.baseURL.length)===i.baseURL&&(s=s.slice(i.baseURL.length)),delete i.adapter,e.history[i.method].push(i);var a=n.findHandler(e.handlers,i.method,s,i.data,i.params,i.headers,i.baseURL);if(a)if(7===a.length&&n.purgeIfReplyOnce(e,a),2===a.length)e.originalAdapter(i).then(t,r);else if("function"!=typeof a[3])n.settle(t,r,o(a.slice(3),i),e.delayResponse);else{var u=a[3](i);"function"!=typeof u.then?n.settle(t,r,o(u,i),e.delayResponse):u.then((function(s){s.config&&s.status?n.settle(t,r,o([s.status,s.data,s.headers],s.config),0):n.settle(t,r,o(s,i),e.delayResponse)}),(function(t){e.delayResponse>0?setTimeout((function(){r(t)}),e.delayResponse):r(t)}))}else switch(e.onNoMatch){case"passthrough":e.originalAdapter(i).then(t,r);break;case"throwException":throw n.createCouldNotFindMockError(i);default:n.settle(t,r,{status:404,config:i},e.delayResponse)}}},138:(e,t,r)=>{"use strict";var n=r(141),o=r(555),i=["get","post","head","delete","patch","put","options","list"];function s(){return i.reduce((function(e,t){return e[t]=[],e}),{})}function a(){u.call(this),c.call(this)}function u(){this.handlers=s()}function c(){this.history=s()}function f(e,t){if(a.call(this),!e)throw new Error("Please provide an instance of axios to mock");this.axiosInstance=e,this.originalAdapter=e.defaults.adapter,this.delayResponse=t&&t.delayResponse>0?t.delayResponse:null,this.onNoMatch=t&&t.onNoMatch||null,e.defaults.adapter=this.adapter.call(this)}function l(e,t,r){if("any"===e)i.forEach((function(e){t[e].push(r)}));else{var n=function(e,t,r){for(var n=-1,i=0;i<t[e].length;i+=1){var s=t[e][i],a=7===s.length;(s[0]instanceof RegExp&&r[0]instanceof RegExp?String(s[0])===String(r[0]):s[0]===r[0])&&o.isEqual(s[1],r[1])&&o.isEqual(s[2],r[2])&&!a&&(n=i)}return n}(e,t,r);n>-1&&r.length<7?t[e].splice(n,1,r):t[e].push(r)}}f.prototype.adapter=function(){return function(e){var t=this;return new Promise((function(r,o){n(t,r,o,e)}))}.bind(this)},f.prototype.restore=function(){this.axiosInstance&&(this.axiosInstance.defaults.adapter=this.originalAdapter,this.axiosInstance=void 0)},f.prototype.reset=a,f.prototype.resetHandlers=u,f.prototype.resetHistory=c,i.concat("any").forEach((function(e){var t="on"+e.charAt(0).toUpperCase()+e.slice(1);f.prototype[t]=function(t,r,n){var i=this;function s(o,s,a){var u=[t,r,n,o,s,a];return l(e,i.handlers,u),i}function a(o,s,a){var u=[t,r,n,o,s,a,!0];return l(e,i.handlers,u),i}return t=void 0===t?/.*/:t,{reply:s,replyOnce:a,passThrough:function(){var n=[t,r];return l(e,i.handlers,n),i},abortRequest:function(){return s((function(e){var t=o.createAxiosError("Request aborted",e,void 0,"ECONNABORTED");return Promise.reject(t)}))},abortRequestOnce:function(){return a((function(e){var t=o.createAxiosError("Request aborted",e,void 0,"ECONNABORTED");return Promise.reject(t)}))},networkError:function(){return s((function(e){var t=o.createAxiosError("Network Error",e);return Promise.reject(t)}))},networkErrorOnce:function(){return a((function(e){var t=o.createAxiosError("Network Error",e);return Promise.reject(t)}))},timeout:function(){return s((function(e){var t=o.createAxiosError(e.timeoutErrorMessage||"timeout of "+e.timeout+"ms exceeded",e,void 0,"ECONNABORTED");return Promise.reject(t)}))},timeoutOnce:function(){return a((function(e){var t=o.createAxiosError(e.timeoutErrorMessage||"timeout of "+e.timeout+"ms exceeded",e,void 0,"ECONNABORTED");return Promise.reject(t)}))}}}})),e.exports=f,e.exports.default=f},376:e=>{e.exports=function(e){return"undefined"!=typeof Blob&&(e instanceof Blob||"[object Blob]"===Object.prototype.toString.call(e))}},555:(e,t,r)=>{"use strict";var n=r(63),o=r(738),i=r(376),s=Object.prototype.toString;function a(e,t){for(var r=e.length,n=0;n<r;n++){var o=e[n];if(t(o))return o}}function u(e){return"[object Function]"===s.call(e)}function c(e){return null!==e&&"object"==typeof e}function f(e,t){return e?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):t}function l(e,t){return("/"===e[0]?e.substr(1):e)===("/"===t[0]?t.substr(1):t)}function p(e,t,r,n){if(["delete","get","head","options"].indexOf(e.toLowerCase())>=0){var o=n?n.data:void 0;return d(r,n?n.params:void 0)&&h(t,o)}return h(t,n)}function d(e,t){return void 0===t||("function"==typeof t.asymmetricMatch?t.asymmetricMatch(e):n(e,t))}function h(e,t){if(void 0===t)return!0;var r;try{r=JSON.parse(e)}catch(e){}return d(r||e,t)}function y(e,t,r,n){var o=new Error(e);return o.isAxiosError=!0,o.config=t,void 0!==r&&(o.response=r),void 0!==n&&(o.code=n),o.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},o}e.exports={find:a,findHandler:function(e,t,r,n,o,i,s){return a(e[t.toLowerCase()],(function(e){return"string"==typeof e[0]?(l(r,e[0])||l(f(s,r),e[0]))&&p(t,n,o,e[1])&&d(i,e[2]):e[0]instanceof RegExp?(e[0].test(r)||e[0].test(f(s,r)))&&p(t,n,o,e[1])&&d(i,e[2]):void 0}))},purgeIfReplyOnce:function(e,t){Object.keys(e.handlers).forEach((function(r){var n=e.handlers[r].indexOf(t);n>-1&&e.handlers[r].splice(n,1)}))},settle:function e(t,r,n,o){o>0?setTimeout(e,o,t,r,n):!n.config.validateStatus||n.config.validateStatus(n.status)?t(n):r(y("Request failed with status code "+n.status,n.config,n))},isStream:function(e){return c(e)&&u(e.pipe)},isArrayBuffer:function(e){return"[object ArrayBuffer]"===s.call(e)},isFunction:u,isObjectOrArray:c,isBuffer:o,isBlob:i,isBodyOrParametersMatching:p,isEqual:n,createAxiosError:y,createCouldNotFindMockError:function(e){var t="Could not find mock for: \n"+JSON.stringify(e,["method","url"],2),r=new Error(t);return r.isCouldNotFindMockError=!0,r.url=e.url,r.method=e.method,r}}}},t={},function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}(138);var e,t})); |
@@ -7,1 +7,20 @@ /*! | ||
*/ | ||
/*! | ||
* MIT License | ||
* | ||
* Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com) | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
* persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
* Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ |
{ | ||
"name": "axios-mock-adapter", | ||
"version": "1.20.0", | ||
"version": "1.21.0", | ||
"description": "Axios adapter that allows to easily mock requests", | ||
@@ -41,20 +41,18 @@ "main": "src/index.js", | ||
"peerDependencies": { | ||
"axios": ">= 0.9.0" | ||
"axios": ">= 0.17.0" | ||
}, | ||
"devDependencies": { | ||
"axios": "^0.21.0", | ||
"axios": "^0.27.2", | ||
"bundlesize": "^0.18.1", | ||
"chai": "^4.3.4", | ||
"eslint": "^7.32.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^9.0.3", | ||
"chai": "^4.3.6", | ||
"eslint": "^8.16.0", | ||
"mocha": "^10.0.0", | ||
"nyc": "^15.1.0", | ||
"rimraf": "^3.0.2", | ||
"webpack": "^5.50.0", | ||
"webpack-bundle-analyzer": "^4.4.2", | ||
"webpack-cli": "^4.7.2" | ||
"webpack": "^5.72.1", | ||
"webpack-bundle-analyzer": "^4.5.0", | ||
"webpack-cli": "^4.9.2" | ||
}, | ||
"dependencies": { | ||
"fast-deep-equal": "^3.1.3", | ||
"is-blob": "^2.1.0", | ||
"is-buffer": "^2.0.5" | ||
@@ -61,0 +59,0 @@ }, |
# axios-mock-adapter | ||
[![Build Status](https://travis-ci.org/ctimmerm/axios-mock-adapter.svg?branch=master)](https://travis-ci.org/ctimmerm/axios-mock-adapter) | ||
[![dependencies Status](https://david-dm.org/ctimmerm/axios-mock-adapter/status.svg)](https://david-dm.org/ctimmerm/axios-mock-adapter) | ||
[![devDependency Status](https://david-dm.org/ctimmerm/axios-mock-adapter/dev-status.svg)](https://david-dm.org/ctimmerm/axios-mock-adapter#info=devDependencies) | ||
Axios adapter that allows to easily mock requests | ||
@@ -20,3 +16,3 @@ | ||
axios-mock-adapter works on Node as well as in a browser, it works with axios v0.9.0 and above. | ||
axios-mock-adapter works on Node as well as in a browser, it works with axios v0.17.0 and above. | ||
@@ -259,5 +255,5 @@ ## Example | ||
mock | ||
.onPost(/\/^api/) | ||
.onPost(/^\/api/) | ||
.reply(201) | ||
.onGet(/\/^api/) | ||
.onGet(/^\/api/) | ||
.passThrough(); | ||
@@ -264,0 +260,0 @@ ``` |
@@ -15,2 +15,4 @@ "use strict"; | ||
"list", | ||
"link", | ||
"unlink", | ||
]; | ||
@@ -21,11 +23,5 @@ | ||
var mockAdapter = this; | ||
// 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(mockAdapter, arguments[0], arguments[1], arguments[2]); | ||
} else { | ||
return new Promise(function (resolve, reject) { | ||
handleRequest(mockAdapter, resolve, reject, config); | ||
}); | ||
} | ||
return new Promise(function (resolve, reject) { | ||
handleRequest(mockAdapter, resolve, reject, config); | ||
}); | ||
}.bind(this); | ||
@@ -32,0 +28,0 @@ } |
"use strict"; | ||
var axios = require("axios"); | ||
var isEqual = require("fast-deep-equal"); | ||
var isBuffer = require("is-buffer"); | ||
var isBlob = require("is-blob"); | ||
var isBlob = require("./is_blob"); | ||
var toString = Object.prototype.toString; | ||
// < 0.13.0 will not have default headers set on a custom instance | ||
var rejectWithError = !!axios.create().defaults.headers; | ||
function find(array, predicate) { | ||
@@ -80,4 +76,5 @@ var length = array.length; | ||
if (allowedParamsMethods.indexOf(method.toLowerCase()) >= 0) { | ||
var data = required ? required.data : undefined; | ||
var params = required ? required.params : undefined; | ||
return isObjectMatching(parameters, params); | ||
return isObjectMatching(parameters, params) && isBodyMatching(body, data); | ||
} else { | ||
@@ -123,12 +120,2 @@ return isBodyMatching(body, required); | ||
// Support for axios < 0.13 | ||
if (!rejectWithError && (!response.config || !response.config.validateStatus)) { | ||
if (response.status >= 200 && response.status < 300) { | ||
resolve(response); | ||
} else { | ||
reject(response); | ||
} | ||
return; | ||
} | ||
if ( | ||
@@ -140,11 +127,9 @@ !response.config.validateStatus || | ||
} else { | ||
if (!rejectWithError) { | ||
return reject(response); | ||
} | ||
reject(createAxiosError( | ||
'Request failed with status code ' + response.status, | ||
response.config, | ||
response | ||
)); | ||
reject( | ||
createAxiosError( | ||
"Request failed with status code " + response.status, | ||
response.config, | ||
response | ||
) | ||
); | ||
} | ||
@@ -207,2 +192,3 @@ } | ||
isBlob: isBlob, | ||
isBodyOrParametersMatching: isBodyOrParametersMatching, | ||
isEqual: isEqual, | ||
@@ -209,0 +195,0 @@ createAxiosError: createAxiosError, |
@@ -59,3 +59,2 @@ import { AxiosAdapter, AxiosInstance, AxiosRequestConfig } from 'axios'; | ||
adapter(): AxiosAdapter; | ||
originalAdapter(): AxiosAdapter; | ||
reset(): void; | ||
@@ -77,4 +76,6 @@ resetHandlers(): void; | ||
onAny: RequestMatcherFunc; | ||
onLink: RequestMatcherFunc; | ||
onUnlink: RequestMatcherFunc; | ||
} | ||
export default MockAdapter; |
@@ -28,6 +28,2 @@ import axios from 'axios'; | ||
namespace ExposesOriginalAdapter { | ||
mock.originalAdapter(); | ||
} | ||
namespace SupportsReset { | ||
@@ -57,2 +53,4 @@ mock.reset(); | ||
mock.onList; | ||
mock.onLink; | ||
mock.onUnlink; | ||
} | ||
@@ -59,0 +57,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
3
10
0
100
0
0
0
40167
12
723
372
- Removedis-blob@^2.1.0
- Removedis-blob@2.1.0(transitive)