Beispiel #1
0
func TestHomeHandler(t *testing.T) {
	runner := muxrunner.InProcessClient()
	req, _ := http.NewRequest("GET", "/", nil)
	response, _ := runner.Do(req)
	testutil.AssertResponseStatus(t, 200, response)
	testutil.AssertResponseBody(t, "HomeHandler", response)
}
Beispiel #2
0
func TestHeaders(t *testing.T) {
	runner := muxrunner.InProcessClient()
	req, _ := http.NewRequest("GET", "/headers", nil)
	req.Header.Add("Foo", "Bar")
	response, _ := runner.Do(req)
	testutil.AssertResponseStatus(t, 200, response)
	testutil.AssertResponseBody(t, "HeaderHandler", response)
	testutil.AssertResponseHeaders(t, map[string]string{"Foo": "Bar"}, response)
}