set route in PB
This commit is contained in:
parent
a9dbfb9201
commit
c0b9518c0d
7
http.go
7
http.go
|
@ -118,6 +118,7 @@ func (pb *Patches) AddHttpToPB(r *http.Request) error {
|
||||||
Host: r.Host,
|
Host: r.Host,
|
||||||
Hostname: r.Header.Get("hostname"),
|
Hostname: r.Header.Get("hostname"),
|
||||||
}
|
}
|
||||||
|
pb.HttpRequest.Route = cleanURL(r.URL.Path)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,3 +147,9 @@ func getClientIP(r *http.Request) string {
|
||||||
}
|
}
|
||||||
return host
|
return host
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove '?' part and trailing '/'
|
||||||
|
func cleanURL(url string) string {
|
||||||
|
url = "/" + strings.Trim(url, "/")
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue