Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

support for mocks when an interceptor retries a request #119

Merged
merged 2 commits into from
Mar 29, 2018

Conversation

ammmze
Copy link
Contributor

@ammmze ammmze commented Feb 26, 2018

I found that if I have an interceptor that was attempting to retry a request (perhaps an interceptor that checks for 401 response codes, then requests a new oauth2 token, then retries the request) it wouldn't use the mock adapter for the retried attempts. I found that in the handle request, we setting the adapter to null. Instead we should actually delete the adapter so axios will use the instance default one.

Looks like this is also the same scenario as issue #68. Essentially any time we tried to retry a request in an interceptor using the same config, it was bypassing the mock adapter and making a real request which is why in Issue #68 they were seeing it give a 404 response code back.

@ctimmerm
Copy link
Owner

Thanks!

@ctimmerm ctimmerm merged commit dd8b660 into ctimmerm:master Mar 29, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants