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

feat: allow typing the body of a RequestError response #2325

Merged
merged 3 commits into from Jan 29, 2024

Conversation

katsanva
Copy link
Contributor

@katsanva katsanva commented Jan 27, 2024

Checklist

Made RequestError/HTTPError to be generic eg.

await got('https://google.com', { responseType: 'json' })
  .catch((err: HTTPError<{ code: number, message: string}>) => console.log(err.response.body.message));

Resolves #2312

  • I have read the documentation.
  • I have included a pull request description of my changes.
  • I have included some tests.
  • If it's a new feature, I have included documentation updates in both the README and the types.

@sindresorhus sindresorhus merged commit 5e4f6ff into sindresorhus:main Jan 29, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

Allow typing the body of a RequestError response
2 participants