Skip to content

Commit

Permalink
Expose RouterPathPatternForRequest
Browse files Browse the repository at this point in the history
This will allow us to extract the path pattern from a requests context, without having to go via the requests route. When used in client filters, the 'router' will not be set correctly, as the req will be outbound, but the context on the req will have preserved the original inbound requests context values.
  • Loading branch information
tomcoupland authored Sep 5, 2024
1 parent ab6ccb7 commit 837b2be
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func RouterForRequest(r Request) *Router {
return nil
}

func routerPathPatternForRequest(r Request) string {
// RouterPathPatternForRequest returns the path pattern this request matched to, or nil.
func RouterPathPatternForRequest(r Request) string {
if v := r.Context.Value(routerRequestPatternContextKey); v != nil {
return v.(string)
}
Expand Down

0 comments on commit 837b2be

Please sign in to comment.