예제 #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
}
예제 #2
0
파일: common.go 프로젝트: GleasonK/go
func CreateContext(inst aetest.Instance) context.Context {
	r, _ := inst.NewRequest("GET", "/", nil)
	ctx := appengine.NewContext(r)
	return ctx
}