Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature request: mux implementation in httptest allowing modification of handler #29838
For a test I was writing, It would be nice if I could change the handler for a
If this is a feature that can be added, I'll be happy to send a PR.
Your issue title says "in httptest", but you're proposing modifying net/http, right? Not httptest?
Can't you just write two small tests rather than one big test?
Or use subtests? Or re-create the ServeMux?
Or use an http.Handler implementation that does the switcheroo muxing itself?
@bradfitz I managed to do this with recreating the ServeMux for each test.
I thought, for net/http's
So, a separate
We can add another method such as
But I don't know if it was necessary, I cannot think of any other usecase other than the original issue I listed above for the test which I was able to solve by recreating the