A / superagent-mocker

Pretty simple in-browser mocks for CRUD and REST API
132 stars 32 forks source link

Mocking an error response #20

Open spencerfdavis opened 8 years ago

spencerfdavis commented 8 years ago

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

A commented 8 years ago

Can you show your code?

dmwelch commented 5 years ago

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