Hey y'all!
For Go 1.22, this enhanced ServeMux routing proposal was accepted and pushed into the main tree, and *http.Request has some new methods, SetPathValue and PathValue. I think r.PathValue(...) could act as an alias for chi.URLParam(r, ...) when routing with chi.
There would probably need to be some logic with //go:build go1.22 that runs SetPathValue when inserting keys/values into chi.Context.URLParams for the corresponding http.Request. I have not dug deeper into chi's source code, but I think this would be a welcome addition for when Go 1.22 is released.
Hey y'all!
For Go 1.22, this enhanced
ServeMuxrouting proposal was accepted and pushed into the main tree, and*http.Requesthas some new methods,SetPathValueandPathValue. I thinkr.PathValue(...)could act as an alias forchi.URLParam(r, ...)when routing with chi.There would probably need to be some logic with
//go:build go1.22that runsSetPathValuewhen inserting keys/values into chi.Context.URLParams for the corresponding http.Request. I have not dug deeper into chi's source code, but I think this would be a welcome addition for when Go 1.22 is released.