MCPcopy Create free account
hub / github.com/NVIDIA/nvcf / maxRequestBodyMiddleware

Function maxRequestBodyMiddleware

src/libraries/go/lib/pkg/core/httpservice.go:565–572  ·  view source on GitHub ↗
(requestBodyLimit int64)

Source from the content-addressed store, hash-verified

563}
564
565func timeoutMiddleware(handlerTimeout time.Duration) mux.MiddlewareFunc {
566 return func(next http.Handler) http.Handler {
567 timeoutMsg := fmt.Sprintf("Request timed out in %v\n", handlerTimeout)
568 return http.TimeoutHandler(next, handlerTimeout, timeoutMsg)
569 }
570}
571
572func maxRequestBodyMiddleware(requestBodyLimit int64) mux.MiddlewareFunc {
573 return func(next http.Handler) http.Handler {
574 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
575 r.Body = http.MaxBytesReader(w, r.Body, requestBodyLimit)

Callers 1

NewHTTPMiddlewareFunction · 0.85

Calls 1

ServeHTTPMethod · 0.45

Tested by

no test coverage detected