ctimmerm / axios-mock-adapter

Axios adapter that allows to easily mock requests
MIT License
3.47k stars 245 forks source link

Feat: expose AxiosError instance #362

Open cangSDARM opened 1 year ago

cangSDARM commented 1 year ago

Expose the internally used util.createAxiosError and provide instance wrappers for common errors such as timeout, networkerror, etc., so that various generic errors can be returned by the custom reply method.

Motivation: I want to test our internal xx-retry library, and it is necessary to REPLY at the mock level to count the actual number of backend calls. But the current reply needs to write a lot of template code to construct the timeout correctly and test the count