mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 03:46:45 +00:00
Add explicity PathReplace middleware (#1393)
This commit is contained in:
@@ -24,3 +24,17 @@ func (p pathRewrite) Wrap(next http.Handler) http.Handler {
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
// PathReplace replcase Request.RequestURI with the specified string.
|
||||
func PathReplace(replacement string) Interface {
|
||||
return pathReplace(replacement)
|
||||
}
|
||||
|
||||
type pathReplace string
|
||||
|
||||
func (p pathReplace) Wrap(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
r.RequestURI = string(p)
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user