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

Don't set shouldRetry=true for HTTP 413 #77

Open
pkubowicz opened this issue Jan 30, 2025 · 0 comments
Open

Don't set shouldRetry=true for HTTP 413 #77

pkubowicz opened this issue Jan 30, 2025 · 0 comments

Comments

@pkubowicz
Copy link

Pusher endpoints return HTTP 413 'Content Too Large' when client sends too much data.

If data is too large, you should not retry to send it again. But the code here suggests to retry.

It's because Result#fromHttpCode has no special case for 413, it is classified as UNKNOWN_ERROR, and UNKNOWN_ERROR has shouldRetry set to true.

I see 2 ways to fix:

  1. Assign 413 to one of existing enum types, like CLIENT_ERROR, where shouldRetry is false
  2. Create a new enum entry for Status, CONTENT_TOO_LARGE, with shouldRetry set to false

I suggest choosing 1, as I think it's safe from logic point of view (sending too large content is very much like sending an invalid content), and is backward compatible from binary point of view.

If you choose 2, this should be a minor or even major version update, according to semantic versioning.

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

1 participant