Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if r.Match(req, &match) {
handler = match.Handler
if handler != nil {
// req is a shallow copy; sync MultipartForm back to the original request on exit.
defer func(originReq *http.Request) {
originReq.MultipartForm = req.MultipartForm
}(req)

// Populate context for custom handlers
if r.omitRouteFromContext {
// Only populate the match vars (if any) into the context.
Expand Down