axios-mock-adapter
axios-mock-adapter copied to clipboard
isSimpleObject breaks onGet when Object.toString() fails
Howdy,
Thank you for this awesome project !
We ran into a bug when attempting to return a value from an intercepted get call. Our return data is fairly complicated and includes several large 2D arrays of floats.
Axios checked to see if our object was simple, and called Object.toString(), which failed. This caused a Type Error to propagate outside of axios.
We were able to resolve the issue by putting the toString code into a try catch like this:
function isSimpleObject(value) {
try {
return value !== null && value !== undefined && value.toString() === '[object Object]';
} catch (e) {
return false;
}
}