MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / Handle

Method Handle

runtime/mux.go:383–388  ·  runtime/mux.go::ServeMux.Handle

Handle associates "h" to the pair of HTTP method and path pattern.

(meth string, pat Pattern, h HandlerFunc)

Source from the content-addressed store, hash-verified

381
382// Handle associates "h" to the pair of HTTP method and path pattern.
383func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) {
384 if len(s.middlewares) > 0 {
385 h = chainMiddlewares(s.middlewares)(h)
386 }
387 s.handlers[meth] = append([]handler{{pat: pat, h: h}}, s.handlers[meth]...)
388}
389
390// HandlePath allows users to configure custom path handlers.
391// refer: https://grpc-ecosystem.github.io/grpc-gateway/docs/operations/inject_router/

Calls 1

chainMiddlewaresFunction · 0.85

Tested by 2

TestMuxServeHTTPFunction · 0.76