Skip to content

Commit d86e4c6

Browse files
committed
exhttp: add StripPrefix middleware
1 parent d608488 commit d86e4c6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

exhttp/middleware.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ func ApplyMiddleware(router http.Handler, middlewares ...Middleware) http.Handle
1515
}
1616
return router
1717
}
18+
19+
// StripPrefix is a wrapper for [http.StripPrefix] is compatible with the middleware pattern.
20+
func StripPrefix(prefix string) Middleware {
21+
return func(next http.Handler) http.Handler {
22+
return http.StripPrefix(prefix, next)
23+
}
24+
}

0 commit comments

Comments
 (0)