MCPcopy Create free account
hub / github.com/golang/appengine / RegisterTestRequest

Function RegisterTestRequest

internal/api.go:307–317  ·  view source on GitHub ↗

RegisterTestRequest registers the HTTP request req for testing, such that any API calls are sent to the provided URL. It should only be used by aetest package.

(req *http.Request, apiURL *url.URL, appID string)

Source from the content-addressed store, hash-verified

305// any API calls are sent to the provided URL.
306// It should only be used by aetest package.
307func RegisterTestRequest(req *http.Request, apiURL *url.URL, appID string) *http.Request {
308 ctx := req.Context()
309 ctx = withAPIHostOverride(ctx, apiURL.Hostname())
310 ctx = withAPIPortOverride(ctx, apiURL.Port())
311 ctx = WithAppIDOverride(ctx, appID)
312
313 // use the unregistered request as a placeholder so that withContext can read the headers
314 c := &aeContext{req: req}
315 c.req = req.WithContext(withContext(ctx, c))
316 return c.req
317}
318
319var errTimeout = &CallError{
320 Detail: "Deadline exceeded",

Callers 1

NewRequestMethod · 0.92

Calls 4

withAPIHostOverrideFunction · 0.70
withAPIPortOverrideFunction · 0.70
WithAppIDOverrideFunction · 0.70
withContextFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…