MCPcopy
hub / github.com/cortesi/devd / Request

Method Request

common_test.go:17–31  ·  view source on GitHub ↗

Request makes a test request

(method string, url string, params url.Values)

Source from the content-addressed store, hash-verified

15
16// Request makes a test request
17func (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
34func AssertCode(t *testing.T, resp *httptest.ResponseRecorder, code int) {

Callers 2

TestDevdRouteHandlerFunction · 0.95
TestDevdHandlerFunction · 0.95

Calls 1

ServeHTTPMethod · 0.45

Tested by

no test coverage detected