Proposals Unofficial Go proposal tracker

Add Server.HandleRequest to apply server processing to external requests

#77441 · net/http · low impact · Implemented in Go 1.28 ·

Before passing a request to the user's handler, http.Server does some extra work. It answers OPTIONS * requests, falls back to DefaultServeMux when Server.Handler is nil, and recovers and logs panics. Code that receives requests some other way, such as an HTTP/3 server or a test, can't reuse this logic and has to copy it.

The new Server.HandleRequest method handles a request as if the server had received it, applying the same behavior.

func (s *h3Server) serveRequest(w http.ResponseWriter, r *http.Request) {
    if err := s.httpServer.HandleRequest(w, r); err != nil {
        // handler panicked; reset the stream
        s.resetStream(r)
    }
}
Proposal
#77441 by neild
Status
Implemented on Nov 5, 2026
Release
Go 1.28
Impact
low
Area
net/http