diff --git a/testing/endtoend/components/tracing_sink.go b/testing/endtoend/components/tracing_sink.go index eba54b2b4d..ac856a9230 100644 --- a/testing/endtoend/components/tracing_sink.go +++ b/testing/endtoend/components/tracing_sink.go @@ -52,7 +52,11 @@ func (ts *TracingSink) Started() <-chan struct{} { // Initialize an http handler that writes all requests to a file. func (ts *TracingSink) initializeSink() { - ts.server = &http.Server{Addr: ts.endpoint} + mux := &http.ServeMux{} + ts.server = &http.Server{ + Addr: ts.endpoint, + Handler: mux, + } defer func() { if err := ts.server.Close(); err != nil { log.WithError(err).Error("Failed to close http server") @@ -69,8 +73,7 @@ func (ts *TracingSink) initializeSink() { log.WithError(err).Error("Could not close stdout file") } } - - http.HandleFunc("/", func(_ http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(_ http.ResponseWriter, r *http.Request) { if err := captureRequest(stdOutFile, r); err != nil { log.WithError(err).Error("Failed to capture http request") return