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

REST client raises an exception on HTTP 204 response #1097

Closed
ClaytonPassmore opened this issue Jan 12, 2023 · 2 comments · Fixed by #1098
Closed

REST client raises an exception on HTTP 204 response #1097

ClaytonPassmore opened this issue Jan 12, 2023 · 2 comments · Fixed by #1098

Comments

@ClaytonPassmore
Copy link
Contributor

Issue summary

When using the REST client to perform an action that returns an HTTP 204 response, such as deleting a discount code or deleting a price rule, the client raises a NoMethodError.

  • shopify_api version: 12.4.0
  • Ruby version: 3.1.3
  • Operating system: Ubuntu 22.04 LTS

Screenshot 2023-01-12 at 10 13 04 AM

Expected behavior

The client should not raise an exception when an endpoint that is supposed to respond with a 204 responds with a 204.

Actual behavior

The client raises a NoMethodError because it tries to call #empty? on the HTTParty::Response object's body, which is nil.

I believe this is happening because HTTParty doesn't parse the response body for 204s and just supplies nil instead. This really old issue on the HTTParty repo seems like it could be related.

Steps to reproduce the problem

The screenshot above says it all, but ...

  1. Create a price rule and/or discount code, note the IDs.
  2. Attempt to delete the discount code or price rule using the REST client.
  3. If the request is successful and responds with a 204, the client will raise a NoMethodError exception

I'm guessing this will happen with any 204 response from the REST API.

@github-actions
Copy link

This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.

@github-actions github-actions bot added the Stale label Mar 14, 2023
@ClaytonPassmore
Copy link
Contributor Author

Definitely still an issue. Waiting on someone to look at #1098 (which has been open for 2 months❗).

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.

1 participant