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

json parse error when the server returns non-json content #1128

Closed
mustafaatikshpfy opened this issue Mar 21, 2023 · 2 comments
Closed

json parse error when the server returns non-json content #1128

mustafaatikshpfy opened this issue Mar 21, 2023 · 2 comments

Comments

@mustafaatikshpfy
Copy link

Issue summary

I encountered a case where the server returned with HTTP 504 Timeout error
and the shopify_api gem tried to parse the response body as json, failed and
raised JSON::ParserError

As far as I understand, we expect the API to return always json response body
but there can be cases like accessing the API via a reverse proxy which can
respond with non-json body. In such cases, can't we still return a specific error
rather than JsonParse?

  • shopify_api version: 10.x (although this should happen in the latest, 12.x version)
  • Ruby version:
  • Operating system:

Expected behavior

Actual behavior

Steps to reproduce the problem

  1. stub the request in a test returning 504 with a non-json response body.
  2. confirm you get a jsonparse error
@kaarelss
Copy link
Contributor

This PR should fix it. Related to #1107 & #1091

@nelsonwittwer
Copy link
Contributor

Closing as #1113 should have fixed this issue. Please re-open if the latest version doesn't solve this issue! thanks!

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

No branches or pull requests

3 participants