Skip to content

How to find what handler ultimately handled a request? #828

Answered by ousloob
jackc asked this question in Q&A
Discussion options

You must be logged in to vote

@jackc
The only solution I could prototype to get the name of the handler is with this:

handlerName := runtime.FuncForPC(reflect.ValueOf(your_handler).Pointer()).Name()

However, we can't directly access the original handler function since it's already wrapped by Chi's routing system.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jackc
Comment options

Answer selected by jackc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants