Skip to content

Commit 0431e12

Browse files
committed
added nil check for failing unit tests
1 parent d9f3dfa commit 0431e12

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

coderd/httpmw/prometheus.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ func getRoutePattern(r *http.Request) string {
113113
}
114114

115115
tctx := chi.NewRouteContext()
116-
if !rctx.Routes.Match(tctx, r.Method, routePath) {
116+
routes := rctx.Routes
117+
if routes != nil && routes.Match(tctx, r.Method, routePath) {
117118
// No matching pattern, so just return an empty string.
118119
// It is done to avoid returning a static path for frontend requests.
119120
return ""

0 commit comments

Comments
 (0)