net/http: allow handlers to modify the http.Request #27277
Labels
Documentation
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
The docs say
At the moment, it seems like modifying the provided http request is safe and this guarantee is restrictive but not useful.
In particular, following this guarantee prevents the subrouting approach presented in https://blog.merovius.de/2017/06/18/how-not-to-use-an-http-router.html as the
*http.Request
's URL is modified when sending it to sub handlers so that they can route the remaining part of the URL on their own. The alternative would be to create a shallow copy of the request every time and then modifying the URL which can become expensive, as there would be a shallow copy for every single segment of the path.The text was updated successfully, but these errors were encountered: