feat: Relax type of get_route_name argument to HttpConnection #276
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this do?
This pr changes the type hint of
get_route_name
to accept aHttpConnection
instead of aRequest
. All informationget_route_name
needs is already provided by the HttpConnection class, which Request is a subclass of. Changing this to HttpConnection allows also passing a WebSocket insteadWhy do we need it?
This allows developers to use the get_route_name function for getting the name of websocket routes as well, which can be very useful for creating custom metrics, e.g. https://github.com/bugbakery/transcribee/pull/389/files#diff-82bbfd4c38c16c9ba393ea259a91bd7a73077f6edc59368d492fe172ac933625R39
Who is this for?
People who want to create own metrics for websocket routes.