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)
| 305 | // any API calls are sent to the provided URL. |
| 306 | // It should only be used by aetest package. |
| 307 | func 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 | |
| 319 | var errTimeout = &CallError{ |
| 320 | Detail: "Deadline exceeded", |
no test coverage detected
searching dependent graphs…