0
0
mirror of https://github.com/rls-moe/nyx synced 2024-09-28 16:03:47 +02:00
nyx/http/middle/limitsize.go

16 lines
343 B
Go

package middle
import (
"go.rls.moe/nyx/config"
"net/http"
)
func LimitSize(c *config.Config) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.Body = http.MaxBytesReader(w, r.Body, 10*1024*1024)
next.ServeHTTP(w, r)
})
}
}