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

retrying of non-idempotent methods #777

Open
F7502 opened this issue Mar 1, 2024 · 2 comments
Open

retrying of non-idempotent methods #777

F7502 opened this issue Mar 1, 2024 · 2 comments

Comments

@F7502
Copy link

F7502 commented Mar 1, 2024

We realized that resty is retrying any HTTP method, even non-idempotent ones. However, this is very unexpected and conflicts with the HTTP specification:
https://datatracker.ietf.org/doc/html/rfc7231#section-4.2.2

In our case it was a POST request that was retried and this then caused problems in our system.

Ideally, resty should change its default behavior to comply with the HTTP specification and only retry idempotent methods.

For now, we managed to achieve the same using a custom retry condition:

AddRetryCondition(
	func(r *resty.Response, err error) bool {
		return isIdempotent(r.Request.Method)
	},
).
@jeevatkm
Copy link
Member

jeevatkm commented Mar 3, 2024

@F7502 Thanks for reporting it.
We can change Resty's default behavior in v3 and provide an on-demand option for Resty users to enable it for other methods.

@jeevatkm jeevatkm added this to the v3.0.0 Milestone milestone Mar 3, 2024
@F7502
Copy link
Author

F7502 commented Mar 4, 2024

Sounds good, many thanks for taking this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants