func testRequestFromSignedRequest(inst aetest.Instance, sr *SignedRequest) (*http.Request, error) {
	srReq, err := sr.HTTPRequest(nil)
	if err != nil {
		return nil, err
	}
	req, err := inst.NewRequest(srReq.Method, srReq.URL.String(), srReq.Body)
	if err != nil {
		return nil, err
	}
	for k, vals := range srReq.Header {
		req.Header[k] = vals
	}

	return req, nil
}
Exemple #2
0
func CreateContext(inst aetest.Instance) context.Context {
	r, _ := inst.NewRequest("GET", "/", nil)
	ctx := appengine.NewContext(r)
	return ctx
}