Skip to content

HTTP responses without a JSON body will raise JSON parser exceptions #357

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

Closed
atesgoral opened this issue Nov 7, 2023 · 2 comments · Fixed by #358
Closed

HTTP responses without a JSON body will raise JSON parser exceptions #357

atesgoral opened this issue Nov 7, 2023 · 2 comments · Fixed by #358

Comments

@atesgoral
Copy link
Contributor

Describe the bug
With #344 there's an oversight: When the OpenAI fetch fails without a JSON error in the body, it will still result in an error being raised, but it will be a JSON parse exception.

To Reproduce
Tweak spec/fixtures/cassettes/gpt-3_5-turbo_streamed_chat_with_error_response.yml to return a 500 and remove the body (or make it invalid JSON).

Expected behavior
A Faraday Internal Server Error should be raised with the original response body.

Additional context
I broke this. I'm fixing it. PR incoming soon.

@alexrudall
Copy link
Owner

Thank you @atesgoral ya legend, released in 6.0.1

@atesgoral
Copy link
Contributor Author

@alexrudall Thanks for the quick release!

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 a pull request may close this issue.

2 participants