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

Handle error responses without any content type. #177

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

plietar
Copy link
Member

@plietar plietar commented Sep 5, 2024

In some circumstances, Packit returns an HTTP error with no body and no Content-Type header. In those cases, httr2 returns NA as the content type.

#166 added a check to make sure the content type is JSON before decoding the error, however the check did not handle NA values properly and gave a missing value where TRUE/FALSE needed.

This now uses identical instead of == to compare the content type string against the expected string.

In some circumstances, Packit returns an HTTP error with no body and no
Content-Type header. In those cases, httr2 returns NA as the
content type.

#166 added a check to make sure the content type is JSON before decoding
the error, however the check did not handle NA values properly and gave
a `missing value where TRUE/FALSE needed`.

This now uses `identical` instead of `==` to compare the content type
string against the expected string.
@plietar plietar requested a review from richfitz September 5, 2024 18:07
Copy link
Member

@richfitz richfitz left a comment

Choose a reason for hiding this comment

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

Thanks, but what a nuisance!

@richfitz richfitz merged commit 1abea95 into main Sep 5, 2024
10 checks passed
@plietar plietar deleted the mrc-5706-error-no-json branch September 6, 2024 00:23
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.

2 participants