|
|
|
@ -64,6 +64,7 @@ func NewHandlerTester(handler http.Handler) HandlerTester {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r.Header.Set("Content-Type", ctype)
|
|
|
|
|
r.Header.Set("Accept", "*/*")
|
|
|
|
|
w := httptest.NewRecorder()
|
|
|
|
|
handler.ServeHTTP(w, r)
|
|
|
|
|
return w, nil
|
|
|
|
@ -87,6 +88,7 @@ func NewServerTester(handler http.Handler) ServerTester {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r.Header.Set("Content-Type", ctype)
|
|
|
|
|
r.Header.Set("Accept", "*/*")
|
|
|
|
|
return http.DefaultClient.Do(r)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -112,6 +114,10 @@ func TestHandlerWithURL(handler http.Handler, method, urlString string) (*httpte
|
|
|
|
|
return NewHandlerTester(handler).TestWithURL(method, urlString)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func LogHandlerText(handler string, v string) {
|
|
|
|
|
log.Printf("%s: %s\n", handler, v)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LogHandlerEntry logs the start of the given handler handling the given request.
|
|
|
|
|
func LogHandlerEntry(handler string, r *http.Request) {
|
|
|
|
|
log.Printf("%s: handling request:%s %s\n", handler, r.Method, r.URL.RequestURI())
|
|
|
|
|