Fix replace path rule

* Fix replace path rule
* test: add RequestURI tests.
This commit is contained in:
dedalusj 2017-07-19 18:27:52 +10:00 committed by Ludovic Fernandez
parent 36ee69609e
commit a09a8b1235
2 changed files with 14 additions and 16 deletions

View file

@ -16,5 +16,6 @@ const ReplacedPathHeader = "X-Replaced-Path"
func (s *ReplacePath) ServeHTTP(w http.ResponseWriter, r *http.Request) {
r.Header.Add(ReplacedPathHeader, r.URL.Path)
r.URL.Path = s.Path
r.RequestURI = r.URL.RequestURI()
s.Handler.ServeHTTP(w, r)
}