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

PDE-1982: fix(core): ResponseError shouldn't assume response.content is always present #320

Merged
merged 1 commit into from
Feb 9, 2021

Conversation

eliangcs
Copy link
Member

@eliangcs eliangcs commented Feb 8, 2021

z.request({raw: true}), usually used for file dehydration, is failing to raise a proper ResponseError when it gets an error response. This is because the ResponseError class assumes response.content is always available, which is not true. In the prepareResponse middleware, we make reponse.content throw an error.

The fix is to be more defensive in ResponseError. When response.content throws an error, we simply keep ResponseError.content null.


fixes #315

@eliangcs eliangcs merged commit c1cc0d9 into master Feb 9, 2021
@eliangcs eliangcs deleted the fix-response-error-no-content branch February 9, 2021 02:18
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.

ResponseError fails when request is raw
2 participants