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

fix: correctly handle empty response bodies #239

Merged
merged 1 commit into from
Mar 1, 2023
Merged

Conversation

dpopp07
Copy link
Member

@dpopp07 dpopp07 commented Mar 1, 2023

There are cases, such as a HEAD request, where the response body will have a JSON content type but the body will be empty (i.e. an empty string). This is technically valid JSON but is not parsable into an object, so the code throws an exception. This commit adds specific handling for this scenario, as well as a couple of test cases

There are cases, such as a HEAD request, where the response body will have
a JSON content type but the body will be empty (i.e. an empty string). This
is technically valid JSON but is not parsable into an object, so the code
throws an exception. This commit adds specific handling for this scenario,
as well as a couple of test cases

Signed-off-by: Dustin Popp <dpopp07@gmail.com>
@dpopp07 dpopp07 requested a review from padamstx March 1, 2023 17:43
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dpopp07 dpopp07 merged commit d0c9cb3 into main Mar 1, 2023
@dpopp07 dpopp07 deleted the dp/fix-json-parsing branch March 1, 2023 17:49
ibm-devx-sdk pushed a commit that referenced this pull request Mar 1, 2023
## [4.0.5](v4.0.4...v4.0.5) (2023-03-01)

### Bug Fixes

* correctly handle empty response bodies ([#239](#239)) ([d0c9cb3](d0c9cb3))
@ibm-devx-sdk
Copy link

🎉 This PR is included in version 4.0.5 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants