mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-06 11:41:28 +00:00
Merge pull request #1555 from weaveworks/improve-rewrites
Rewrite net/http.Request.{URL.Path,RequestURI} consistently
This commit is contained in:
@@ -21,7 +21,7 @@ type pathRewrite struct {
|
||||
func (p pathRewrite) Wrap(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
r.RequestURI = p.regexp.ReplaceAllString(r.RequestURI, p.replacement)
|
||||
r.URL.Path = p.regexp.ReplaceAllString(r.RequestURI, p.replacement)
|
||||
r.URL.Path = p.regexp.ReplaceAllString(r.URL.Path, p.replacement)
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
@@ -35,6 +35,7 @@ type pathReplace string
|
||||
|
||||
func (p pathReplace) Wrap(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
r.URL.Path = string(p)
|
||||
r.RequestURI = string(p)
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user