mirror of
https://github.com/twofas/2fas-server.git
synced 2024-12-12 12:09:56 +01:00
16 lines
292 B
Go
16 lines
292 B
Go
package http
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func BodySizeLimitMiddleware(requestBytesLimit int64) gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
var w http.ResponseWriter = c.Writer
|
|
|
|
c.Request.Body = http.MaxBytesReader(w, c.Request.Body, requestBytesLimit)
|
|
}
|
|
}
|