feat: send human-readable error for 429

This commit is contained in:
httpjamesm 2022-12-29 13:49:19 -05:00
parent e476087a3a
commit 4ddc1a2af7

View File

@ -31,7 +31,10 @@ func Ratelimit() gin.HandlerFunc {
// if they exceed 30 requests in 1 minute, return a 429
if val.(int) > 30 {
c.String(429, "429 Too Many Requests")
c.HTML(429, "home.html", gin.H{
"errorMessage": "You have exceeded the request limit. Please try again in a minute.",
"theme": c.MustGet("theme").(string),
})
c.Abort()
return
}