修复限流不返回报错信息的bug (#1966)
This commit is contained in:
parent
d24eeefc86
commit
f6c2ce45c1
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue