修复限流不返回报错信息的bug (#1966)

This commit is contained in:
Brandon-lz 2024-12-17 16:57:28 +08:00 committed by GitHub
parent d24eeefc86
commit f6c2ce45c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ type LimitConfig struct {
func (l LimitConfig) LimitWithTime() gin.HandlerFunc { func (l LimitConfig) LimitWithTime() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
if err := l.CheckOrMark(l.GenerationKey(c), l.Expire, l.Limit); err != nil { if err := l.CheckOrMark(l.GenerationKey(c), l.Expire, l.Limit); err != nil {
c.JSON(http.StatusOK, gin.H{"code": response.ERROR, "msg": err}) c.JSON(http.StatusOK, gin.H{"code": response.ERROR, "msg": err.Error()})
c.Abort() c.Abort()
return return
} else { } else {