Skip to content

Commit 6c197cb

Browse files
committed
set a new route ctx if rctx is nil
1 parent 58ca6d6 commit 6c197cb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

middleware/url_format.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ func URLFormat(next http.Handler) http.Handler {
5555
path = rctx.RoutePath
5656
}
5757

58+
if rctx == nil {
59+
rctx = chi.NewRouteContext()
60+
}
61+
5862
if strings.Index(path, ".") > 0 {
5963
base := strings.LastIndex(path, "/")
6064
idx := strings.LastIndex(path[base:], ".")

0 commit comments

Comments
 (0)