예제 #1
0
파일: test.go 프로젝트: itsabot/abot
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())
}