mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: idea: unify http responses further (#941)
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-chi/httprate"
|
||||
"github.com/go-chi/render"
|
||||
|
||||
"github.com/coder/coder/coderd/database"
|
||||
"github.com/coder/coder/coderd/httpapi"
|
||||
@@ -26,8 +25,7 @@ func RateLimitPerMinute(count int) func(http.Handler) http.Handler {
|
||||
return httprate.KeyByIP(r)
|
||||
}, httprate.KeyByEndpoint),
|
||||
httprate.WithLimitHandler(func(w http.ResponseWriter, r *http.Request) {
|
||||
render.Status(r, http.StatusTooManyRequests)
|
||||
render.JSON(w, r, httpapi.Response{
|
||||
httpapi.Write(w, http.StatusTooManyRequests, httpapi.Response{
|
||||
Message: "You've been rate limited for sending too many requests!",
|
||||
})
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user