http/client: log errors when stream copy fails
License: MIT Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
Juan Batiz-Benet committed
Jul 24, 2015 at 14:41 UTC
886d47561a014aa3ee275207069404ad9e954362
1 file changed
+4
-9
commands/http/handler.go
+4
-9
@@ -166,19 +166,14 @@ func (i internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
166
167
streamChans, _, _ := req.Option("stream-channels").Bool()
168
if isChan && streamChans {
169
- // w.WriteString(transferEncodingHeader + ": chunked\r\n")
170
- // w.Header().Set(channelHeader, "1")
171
- // w.WriteHeader(200)
172
- err = copyChunks(applicationJson, w, out)
173
- if err != nil {
174
- log.Debug("copy chunks error: ", err)
169
+ if err := copyChunks(applicationJson, w, out); err != nil {
170
+ log.Error("error while writing stream", err)
171
}
172
return
173
}
174
179
- err = flushCopy(w, out)
180
- if err != nil {
181
- log.Debug("Flush copy returned an error: ", err)
175
+ if err := flushCopy(w, out); err != nil {
176
+ log.Error("error while writing stream", err)
177
}
178
}
179