-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to mock reject reponse with status > 400 #6
Comments
I manage to do it via following :-
Thanks for this lib. |
For anyone using moxios.stubRequest(/.*/, {
status: 400,
response: { message: 'problem' }
});
axios.get('something')
.then(() => {
// Not hit
})
.catch(error => {
// Error
}); @Sutikshan it looks like |
@rickhanlonii with
with
|
@mrchief you can use
|
Its not an issue with moxios, just a quirk of axios: axios/axios#960 (comment) Went with the interceptor approach and now I can reliably check my asserts. |
I've tried all of the proposed solutions above and in theory they should work but I'm getting 'Request failed with status code With any successful code it works but with non-success codes it throws that error |
Hi @simonsankar, |
Answered on this thread |
How to mock reject reponse with status > 400 .
I want to mock errorneous response i.g.
How can I do it?
The text was updated successfully, but these errors were encountered: