Exemplo n.º 1
0
func newBackendHTTPRequest(inst aetest.Instance, method string, body []byte) *http.Request {
	if body == nil {
		body = []byte{}
	}
	buf := bytes.NewBuffer(body)
	url := fmt.Sprintf("/_ah/spi/BackendService.%s", method)
	req, err := inst.NewRequest("POST", url, buf)
	if err != nil {
		log.Fatalf("failed to create req: %v", err)
	}
	return req
}
Exemplo n.º 2
0
func CreateContext(inst aetest.Instance) context.Context {
	r, _ := inst.NewRequest("GET", "/", nil)
	ctx := appengine.NewContext(r)
	return ctx
}