MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Namespace

Function Namespace

pkg/webmiddleware/namespace.go:24–30  ·  view source on GitHub ↗

Namespace is middleware that sets the namespace.

(value string)

Source from the content-addressed store, hash-verified

22
23// Namespace is middleware that sets the namespace.
24func Namespace(value string) MiddlewareFunc {
25 return func(next http.Handler) http.Handler {
26 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
27 next.ServeHTTP(w, r.WithContext(log.NewContextWithField(r.Context(), "namespace", value)))
28 })
29 }
30}

Callers 5

RegisterRoutesMethod · 0.92
RegisterRoutesMethod · 0.92
RegisterRoutesMethod · 0.92
RegisterRoutesMethod · 0.92
TestNamespaceFunction · 0.85

Calls 3

NewContextWithFieldFunction · 0.92
ContextMethod · 0.65
ServeHTTPMethod · 0.45

Tested by 1

TestNamespaceFunction · 0.68