(t *testing.T, c *Client, sendReq func(*Request) *Response, expectMethod string, expectPanic bool)
| 149 | } |
| 150 | |
| 151 | func 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 | |
| 167 | type dumpExpected struct { |
| 168 | ReqHeader bool |
no test coverage detected
searching dependent graphs…