Skip to content
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

Mocking an error response #20

Open
spencerfdavis opened this issue Dec 17, 2015 · 2 comments
Open

Mocking an error response #20

spencerfdavis opened this issue Dec 17, 2015 · 2 comments

Comments

@spencerfdavis
Copy link

I'm trying to mock a POST call that would return a 401 Unauthorized error for some testing. Any way to do this?

@A
Copy link
Owner

A commented Dec 17, 2015

Can you show your code?

@dmwelch
Copy link

dmwelch commented Nov 30, 2018

This works for me:

mock.get(url, (req) => ( {status: 500, body: {error:'batman'}} ))

It would be a good idea to have something in the README, @A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants