Web: Preserve context from request (#5404)
The `http.Request` object can already have a context associated with it. If it does, preserve that context rather than creating a new one. If it doesn't, create a new `context.Background` instead.
This commit is contained in:
parent
7bf854fe03
commit
d59e715c9d
|
|
@ -57,8 +57,7 @@ func (e *RequestEvent) AddError(msg string, args ...interface{}) {
|
|||
type WFEHandlerFunc func(context.Context, *RequestEvent, http.ResponseWriter, *http.Request)
|
||||
|
||||
func (f WFEHandlerFunc) ServeHTTP(e *RequestEvent, w http.ResponseWriter, r *http.Request) {
|
||||
ctx := context.TODO()
|
||||
f(ctx, e, w, r)
|
||||
f(r.Context(), e, w, r)
|
||||
}
|
||||
|
||||
type wfeHandler interface {
|
||||
|
|
|
|||
Loading…
Reference in New Issue