Request executes an HTTP request against the tester
(method, url string, values url.Values)
| 30 | |
| 31 | // Request executes an HTTP request against the tester |
| 32 | func (f *HandlerFuncTest) Request(method, url string, values url.Values) error { |
| 33 | w := httptest.NewRecorder() |
| 34 | |
| 35 | req, err := f.request(method, url, values) |
| 36 | if err != nil { |
| 37 | return err |
| 38 | } |
| 39 | |
| 40 | f.Handler(w, req) |
| 41 | |
| 42 | f.body = w.Body.Bytes() |
| 43 | f.code = w.Code |
| 44 | |
| 45 | return nil |
| 46 | } |
| 47 | |
| 48 | // AssertCode asserts the response code |
| 49 | func (f *HandlerFuncTest) AssertCode(t *testing.T, code int) { |