diff options
Diffstat (limited to 'plugins/http/attributes/attributes.go')
-rw-r--r-- | plugins/http/attributes/attributes.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/http/attributes/attributes.go b/plugins/http/attributes/attributes.go index 81d9f01d..243b6c78 100644 --- a/plugins/http/attributes/attributes.go +++ b/plugins/http/attributes/attributes.go @@ -39,7 +39,11 @@ func (v attrs) del(key string) { // Init returns request with new context and attribute bag. func Init(r *http.Request) *http.Request { - return r.WithContext(context.WithValue(r.Context(), PsrContextKey, attrs{})) + // do not overwrite psr attributes + if val := r.Context().Value(PsrContextKey); val == nil { + return r.WithContext(context.WithValue(r.Context(), PsrContextKey, attrs{})) + } + return r } // All returns all context attributes. |