MCPcopy
hub / github.com/harness/harness / URLHandler

Function URLHandler

app/api/middleware/logging/logging.go:79–92  ·  view source on GitHub ↗
(fieldKey string)

Source from the content-addressed store, hash-verified

77}
78
79func URLHandler(fieldKey string) func(next http.Handler) http.Handler {
80 return func(next http.Handler) http.Handler {
81 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
82 log := zerolog.Ctx(r.Context())
83 log.UpdateContext(func(c zerolog.Context) zerolog.Context {
84 if r.URL.RawPath != "" {
85 return c.Str(fieldKey, r.URL.RawPath+"?"+r.URL.RawQuery)
86 }
87 return c.Str(fieldKey, r.URL.Path+"?"+r.URL.RawQuery)
88 })
89 next.ServeHTTP(w, r)
90 })
91 }
92}

Callers 2

NewAPIHandlerFunction · 0.92
NewGitHandlerFunction · 0.92

Calls 1

ServeHTTPMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…