Bump github.com/go-chi/httprate from 0.9.0 to 0.14.1
Bumps github.com/go-chi/httprate from 0.9.0 to 0.14.1.
Release notes
Sourced from github.com/go-chi/httprate's releases.
v0.14.0
What's Changed
- Implement rate-limiting from HTTP handler (e.g. by request payload) by
@VojtechVitekin go-chi/httprate#42- Export http.RateLimiter type by
@VojtechVitekin go-chi/httprate#43- Introduce RespondOnLimit() vs. OnLimit() methods by
@VojtechVitekin go-chi/httprate#44Add support to rate-limit by custom key from HTTP handler (e.g. by request payload fields)
// Rate-limiter for login endpoint. loginRateLimiter := httprate.NewRateLimiter(5, time.Minute)r.Post("/login", func(w http.ResponseWriter, r *http.Request) {
var payload struct {
Username stringjson:"username"
Password stringjson:"password"
}
err := json.NewDecoder(r.Body).Decode(&payload)
if err != nil || payload.Username == "" || payload.Password == "" {
w.WriteHeader(400)
return
}// Rate-limit login at 5 req/min. if loginRateLimiter.RespondOnLimit(w, r, payload.Username) { return }w.Write([]byte("login at 5 req/min\n"))
})
Full Changelog: https://github.com/go-chi/httprate/compare/v0.12.1...v0.14.0
v0.13.1
What's Changed
- Export http.RateLimiter type by
@VojtechVitekin go-chi/httprate#43 so users can pass*http.RateLimiter(or save in their server struct) and use the new.OnLimit()feature from go-chi/httprate#42.Full Changelog: https://github.com/go-chi/httprate/compare/v0.13.0...v0.13.1
v0.13.0
Full Changelog: https://github.com/go-chi/httprate/compare/v0.13.0...v0.13.0
Add support to rate-limit by custom key from HTTP handler (e.g. by request payload fields)
// Rate-limiter for login endpoint. loginRateLimiter := httprate.NewRateLimiter(5, time.Minute)r.Post("/login", func(w http.ResponseWriter, r *http.Request) {
var payload struct {
</tr></table>
... (truncated)
Commits
ae11543Add httpate.Key(string) helper for static keys (#45)5e681e3Introduce RespondOnLimit() vs. OnLimit() (#44)c4c778cExport RateLimiter type (#43)80029e2Implement rate-limiting from HTTP handler (e.g. by request payload) (#42)99b3b69README: Fix typo62dba55Implement httprate.WithErrorHandler() (#41)6aa26b0Local counter: Don't re-allocate maps in Go 1.21+ (#40)9e50ad6Export in-memory counter for external use (#39)05a79e9Upgrade to actions/setup-go@v5, improve README (#38)4afd620Improve example, add go module (#37)- Additional commits viewable in compare view
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
-
@dependabot rebasewill rebase this PR -
@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it -
@dependabot mergewill merge this PR after your CI passes on it -
@dependabot squash and mergewill squash and merge this PR after your CI passes on it -
@dependabot cancel mergewill cancel a previously requested merge and block automerging -
@dependabot reopenwill reopen this PR if it is closed -
@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually -
@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency -
@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) -
@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) -
@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)