func request(r *httprouter.Router, method, path string, data []byte) (int, string) { req, err := http.NewRequest(method, path, bytes.NewBuffer(data)) if err != nil { return 0, "err completing request: " + err.Error() } w := httptest.NewRecorder() r.ServeHTTP(w, req) return w.Code, string(w.Body.Bytes()) }