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

replyWithError doesn't work with got #1661

Closed
tkalinowskiIress opened this issue Aug 7, 2019 · 2 comments · Fixed by #1687
Closed

replyWithError doesn't work with got #1661

tkalinowskiIress opened this issue Aug 7, 2019 · 2 comments · Fixed by #1687
Labels
released support General questions or support.

Comments

@tkalinowskiIress
Copy link

What is the expected behavior?

replyWithError('err') or reply(500, {error: 'err'}) should return give valid error response in catch block when doing a request with got

What is the actual behavior?

Nock is crashing

Possible solution

How to reproduce the issue

Glitch: Example link
Codesandbox: Example link

Does the bug have a test case?

Versions

Latest stable and beta. I for some reason latest beta has some problem with dependencies on both Glitch and CodeSandbox, so i've used 11.0.0-beta.29 but it reproduces locally

Software Version(s)
Nock 11.0.0-beta.29
got 9.6.0
Node
@paulmelnikow
Copy link
Member

Ahhh, see #1523.

Got issues retries by default. This makes for confusing testing, and I think perhaps not a great default.

Try:

const response = await got("http://test/", { retry: 0 });

Or see our solution:

const got = require('got')
// https://github.com/nock/nock/issues/1523
module.exports = got.extend({ retry: 0 })

I expect other devs to run into this issue so I'd welcome a pull request with a documentation update!

@nockbot
Copy link
Collaborator

nockbot commented Aug 23, 2019

🎉 This issue has been resolved in version 11.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants