Skip to content

Place the unexpanded route path in the request Context

Compare
Choose a tag to compare
@dimfeld dimfeld released this 16 Apr 18:57
· 20 commits to master since this release
e7c8e18

This is mostly to allow logging middleware to show the actual route matched without expanded wildcards.

Request context data can now be accessed using httptreemux.ContextData(r.Context()), which returns an interface ContextRouteData containing the parameters and the route path. The old ContextParams method is no longer recommended, but will continue to exist and work as before.

Thanks to @stuartclan for the suggestion and help with the implementation and review!