Exemple #1
0
func (s *GAEServer) Run() error {
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		req := wcg.NewRequest(r)
		s.routes.Dispatch(wcg.NewResponse(w, req), req)
	})
	return nil
}
Exemple #2
0
func Request(method string, path string, body io.Reader) *TestRequest {
	r, err := http.NewRequest(method, path, body)
	if err != nil {
		panic(err)
	}
	req := wcg.NewTestRequest(r)
	recorder := httptest.NewRecorder()
	res := wcg.NewResponse(recorder, req)
	return &TestRequest{req, res, recorder}
}