Request makes a test request
(method string, url string, params url.Values)
| 15 | |
| 16 | // Request makes a test request |
| 17 | func (ht *handlerTester) Request(method string, url string, params url.Values) *httptest.ResponseRecorder { |
| 18 | req, err := http.NewRequest(method, url, strings.NewReader(params.Encode())) |
| 19 | if err != nil { |
| 20 | ht.t.Errorf("%v", err) |
| 21 | } |
| 22 | if params != nil { |
| 23 | req.Header.Set( |
| 24 | "Content-Type", |
| 25 | "application/x-www-form-urlencoded; param=value", |
| 26 | ) |
| 27 | } |
| 28 | w := httptest.NewRecorder() |
| 29 | ht.h.ServeHTTP(w, req) |
| 30 | return w |
| 31 | } |
| 32 | |
| 33 | // AssertCode asserts that the HTTP return code matches an expected value |
| 34 | func AssertCode(t *testing.T, resp *httptest.ResponseRecorder, code int) { |
no test coverage detected