This commit is contained in:
@@ -47,17 +47,17 @@ func ValidateRequest(service, permission string, conn *grpc.ClientConn) gin.Hand
|
||||
return
|
||||
}
|
||||
|
||||
// Set the remaining rate limits in the response headers
|
||||
ctx.Header(HeaderRateLimitBurst, strconv.FormatUint(resp.RemainingBurst, 10))
|
||||
ctx.Header(HeaderRateLimitDaily, strconv.FormatUint(resp.RemainingDaily, 10))
|
||||
ctx.Header(HeaderRateLimitMonthly, strconv.FormatUint(resp.RemainingMonthly, 10))
|
||||
|
||||
if !resp.Valid {
|
||||
ctx.JSON(int(resp.StatusCode), gin.H{"error": resp.ErrorMessage})
|
||||
ctx.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
// Set the remaining rate limits in the response headers
|
||||
ctx.Header(HeaderRateLimitBurst, strconv.FormatUint(resp.RemainingBurst, 10))
|
||||
ctx.Header(HeaderRateLimitDaily, strconv.FormatUint(resp.RemainingDaily, 10))
|
||||
ctx.Header(HeaderRateLimitMonthly, strconv.FormatUint(resp.RemainingMonthly, 10))
|
||||
|
||||
ctx.Next()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user