Request returns the HTTP request stored in ctx. If there is none, it panics. The context given to a handler function registered in this package is guaranteed to have a request.
(ctx context.Context)
| 23 | // registered in this package is guaranteed to have |
| 24 | // a request. |
| 25 | func Request(ctx context.Context) *http.Request { |
| 26 | return ctx.Value(reqKey).(*http.Request) |
| 27 | } |
| 28 | |
| 29 | // ResponseWriter returns the HTTP response writer stored in ctx. |
| 30 | // If there is none, it panics. |