chore(coderd/httpmw): extract HTTPRoute middleware (#21498)

Extracts part of the prometheus middleware that stores the route
information in the request context into its own middleware. Also adds
request method information to context.

Relates to https://github.com/coder/internal/issues/1214
This commit is contained in:
Cian Johnston
2026-01-15 10:26:50 +00:00
committed by GitHub
parent 6683d807ac
commit 32354261d3
5 changed files with 184 additions and 33 deletions
+1
View File
@@ -881,6 +881,7 @@ func New(options *Options) *API {
loggermw.Logger(api.Logger),
singleSlashMW,
rolestore.CustomRoleMW,
httpmw.HTTPRoute, // NB: prometheusMW depends on this middleware.
prometheusMW,
// Build-Version is helpful for debugging.
func(next http.Handler) http.Handler {