Skip to content

Commit

Permalink
exhttp: add StripPrefix middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Oct 11, 2024
1 parent d608488 commit d86e4c6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions exhttp/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ func ApplyMiddleware(router http.Handler, middlewares ...Middleware) http.Handle
}
return router
}

// StripPrefix is a wrapper for [http.StripPrefix] is compatible with the middleware pattern.
func StripPrefix(prefix string) Middleware {
return func(next http.Handler) http.Handler {
return http.StripPrefix(prefix, next)
}
}

0 comments on commit d86e4c6

Please sign in to comment.