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

Function TestMuxServeHTTP

runtime/mux_test.go:24–633  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestMuxServeHTTP(t *testing.T) {
25 type stubPattern struct {
26 method string
27 ops []int
28 pool []string
29 verb string
30 }
31 for i, spec := range []struct {
32 patterns []stubPattern
33
34 reqMethod string
35 reqPath string
36 headers map[string]string
37
38 respStatus int
39 respContent string
40
41 disablePathLengthFallback bool
42 unescapingMode runtime.UnescapingMode
43 }{
44 {
45 patterns: nil,
46 reqMethod: "GET",
47 reqPath: "/",
48 respStatus: http.StatusNotFound,
49 },
50 {
51 patterns: []stubPattern{
52 {
53 method: "GET",
54 ops: []int{int(utilities.OpLitPush), 0},
55 pool: []string{"foo"},
56 },
57 },
58 reqMethod: "GET",
59 reqPath: "/foo",
60 respStatus: http.StatusOK,
61 respContent: "GET /foo",
62 },
63 {
64 patterns: []stubPattern{
65 {
66 method: "GET",
67 ops: []int{int(utilities.OpLitPush), 0},
68 pool: []string{"foo"},
69 },
70 },
71 reqMethod: "GET",
72 reqPath: "/bar",
73 respStatus: http.StatusNotFound,
74 },
75 {
76 patterns: []stubPattern{
77 {
78 method: "GET",
79 ops: []int{int(utilities.OpPush), 0},
80 },
81 {

Callers

nothing calls this directly

Calls 9

HandleMethod · 0.95
StringMethod · 0.95
ServeHTTPMethod · 0.95
WithUnescapingModeFunction · 0.92
NewServeMuxFunction · 0.92
NewPatternFunction · 0.92
SetMethod · 0.80
UnmarshalMethod · 0.65

Tested by

no test coverage detected