Rate limits should be per-method, not per-resource string.
This commit is contained in:
1 parent
2922793427
commit
2ada2b5936
3 files changed
+11
-11
No files matched your search
@@ -125,7 +125,7 @@ func UnauthRateLimit() gin.HandlerFunc {
|
||||
|
||||
ip := c.ClientIP()
|
||||
|
||||
if !unauthed.take(ip, "") {
|
||||
if !unauthed.take(ip, c.Request.Method+":"+c.FullPath()) {
|
||||
c.AbortWithStatus(http.StatusTooManyRequests)
|
||||
return
|
||||
}
|
||||
@@ -156,7 +156,7 @@ func AuthedRateLimit() gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
if !authed.take(p.Uid.String(), c.FullPath()) {
|
||||
if !authed.take(p.Uid.String(), c.Request.Method+":"+c.FullPath()) {
|
||||
c.AbortWithStatus(http.StatusTooManyRequests)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user