summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-05 14:16:45 -0500
committerJeff Carr <[email protected]>2025-09-05 14:17:30 -0500
commitc0b9518c0db72aa40e4e37e3d90341b32b364bd5 (patch)
treec05dc34bfc87cfcc4582a5dc5988a7a8f3339dce
parenta9dbfb9201f556e4df4d5c8234bedcc9d7c33052 (diff)
set route in PB
-rw-r--r--http.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/http.go b/http.go
index 0e3a56b..27d6e06 100644
--- a/http.go
+++ b/http.go
@@ -118,6 +118,7 @@ func (pb *Patches) AddHttpToPB(r *http.Request) error {
Host: r.Host,
Hostname: r.Header.Get("hostname"),
}
+ pb.HttpRequest.Route = cleanURL(r.URL.Path)
return nil
}
@@ -146,3 +147,9 @@ func getClientIP(r *http.Request) string {
}
return host
}
+
+// remove '?' part and trailing '/'
+func cleanURL(url string) string {
+ url = "/" + strings.Trim(url, "/")
+ return url
+}