[#7575] use memory+file buffer when rereading the request body (fix #7572)

This commit is contained in:
Gani Georgiev
2026-03-09 17:19:09 +02:00
parent 93e3eb3a35
commit ba8b51af58
9 changed files with 454 additions and 35 deletions

View File

@@ -132,7 +132,10 @@ func (r *Router[T]) loadMux(mux *http.ServeMux, group *RouterGroup[T], parents [
resp = &ResponseWriter{ResponseWriter: resp}
// wrap the request body to allow multiple reads
req.Body = &RereadableReadCloser{ReadCloser: req.Body}
body := &RereadableReadCloser{ReadCloser: req.Body}
defer body.Close()
req.Body = body
event, cleanupFunc := r.eventFactory(resp, req)