MCPcopy Index your code
hub / github.com/imroc/req / testMethod

Function testMethod

request_test.go:151–165  ·  view source on GitHub ↗
(t *testing.T, c *Client, sendReq func(*Request) *Response, expectMethod string, expectPanic bool)

Source from the content-addressed store, hash-verified

149}
150
151func testMethod(t *testing.T, c *Client, sendReq func(*Request) *Response, expectMethod string, expectPanic bool) {
152 r := c.R()
153 if expectPanic {
154 defer func() {
155 if err := recover(); err == nil {
156 t.Errorf("Must method %s should panic", expectMethod)
157 }
158 }()
159 }
160 resp := sendReq(r)
161 method := resp.Header.Get("Method")
162 if expectMethod != method {
163 t.Errorf("Expect method %s, got method %s", expectMethod, method)
164 }
165}
166
167type dumpExpected struct {
168 ReqHeader bool

Callers 2

TestMustSendMethodsFunction · 0.85
TestSendMethodsFunction · 0.85

Calls 3

RMethod · 0.80
ErrorfMethod · 0.65
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…