MCPcopy Create free account
hub / github.com/DoNewsCode/core / ServeHTTP

Method ServeHTTP

ctxmeta/example_middleware_test.go:18–24  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

16}
17
18func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
19 bag := ctxmeta.GetBaggage(r.Context())
20 bag.Set("method", r.Method)
21 bag.Set("path", r.URL.Path)
22 bag.Set("content_length", r.ContentLength)
23 fmt.Fprintln(w, "OK")
24}
25
26type Middleware struct {
27 next http.Handler

Callers 4

TestDebugModuleFunction · 0.45
ServeHTTPMethod · 0.45

Calls 2

GetBaggageFunction · 0.92
SetMethod · 0.45

Tested by

no test coverage detected