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

Send "Retry-After" to comply with RFC6585 #141

Merged
merged 3 commits into from
Jul 9, 2018
Merged

Send "Retry-After" to comply with RFC6585 #141

merged 3 commits into from
Jul 9, 2018

Conversation

herver
Copy link
Contributor

@herver herver commented Jun 20, 2018

This is related to #139.

It makes sure we send the Retry-After "hint" in the correct format.

Also use Golang const for HTTP status
@@ -180,8 +180,8 @@ type RateErrHandler struct {

func (e *RateErrHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, err error) {
if rerr, ok := err.(*MaxRateError); ok {
w.Header().Set("X-Retry-In", rerr.delay.String())
w.WriteHeader(429)
w.Header().Set("Retry-After", fmt.Sprintf("%.0f", rerr.delay.Seconds()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid breaking, you must keep X-Retry-In for backward compatibility.

@ldez
Copy link
Member

ldez commented Jul 9, 2018

@herver could you rebase on master ?

Copy link
Contributor

@juliens juliens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@emilevauge emilevauge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@emilevauge emilevauge merged commit 52415e2 into vulcand:master Jul 9, 2018
@herver herver deleted the patch-1 branch July 9, 2018 13:51
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 this pull request may close these issues.

None yet

4 participants