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

Backport #1543: Initialize globalResponse in case of ignored HTTPError #2017

Merged
merged 2 commits into from Apr 6, 2022

Conversation

nextlevelbeard
Copy link

@nextlevelbeard nextlevelbeard commented Mar 25, 2022

Backports #1543 to v11

Fixes #1540 :

When the server returns an error code with JSON body, and I try to parse it using .json() and {throwHttpErrors: false}, I get the following error:

TypeError: Cannot read property 'request' of undefined
    at /path/to/my/project/node_modules/got/dist/source/as-promise/index.js:157:48
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Checklist

  • 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.

@nextlevelbeard
Copy link
Author

@sindresorhus

@sindresorhus
Copy link
Owner

You need to backport the test change too, so we can be sure it works on v11 too.

@nextlevelbeard
Copy link
Author

Added the test, should be good to go.

@nextlevelbeard
Copy link
Author

@sindresorhus

@sindresorhus sindresorhus merged commit 20f29fe into sindresorhus:v11 Apr 6, 2022
@nextlevelbeard nextlevelbeard deleted the patch-1 branch April 6, 2022 14:22
@sindresorhus
Copy link
Owner

Unfortunately, listing and TypeScript fails when I running tests for the v11 branch locally. I don't have time to look into it, so this needs to be fixed before a release is possible.

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.

None yet

2 participants