Don't panic when a http.ResponseWriter does not implement CloseNotifier
Instead, provide a variant of instrumentedResponseWriter that does not implement CloseNotifier, and use that when necessary. In copyFullPayload, log instead of panicing when we encounter something that doesn't implement CloseNotifier. This is more complicated than I'd like, but it's necessary because instrumentedResponseWriter must not embed CloseNotifier unless there's really a CloseNotifier to embed. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
68c0706bac
commit
e7435725af
1 changed files with 1 additions and 1 deletions
|
@ -29,7 +29,7 @@ func copyFullPayload(responseWriter http.ResponseWriter, r *http.Request, destWr
|
|||
if notifier, ok := responseWriter.(http.CloseNotifier); ok {
|
||||
clientClosed = notifier.CloseNotify()
|
||||
} else {
|
||||
panic("the ResponseWriter does not implement CloseNotifier")
|
||||
ctxu.GetLogger(context).Warn("the ResponseWriter does not implement CloseNotifier")
|
||||
}
|
||||
|
||||
// Read in the data, if any.
|
||||
|
|
Loading…
Reference in a new issue