mirror of
https://github.com/rls-moe/nyx
synced 2024-11-14 22:12:24 +00:00
16 lines
343 B
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)
|
||
|
})
|
||
|
}
|
||
|
}
|