func send(req *http.Request) Response {
	record := httptest.NewRecorder()
	config.Router().ServeHTTP(record, req)

	responseBody := M{}
	json.Unmarshal(record.Body.Bytes(), &responseBody)

	log(record.Body.String())

	return Response{
		code: record.Code,
		body: responseBody,
	}
}
Exemple #2
0
func init() {
	http.Handle("/", config.Router())
}