commands/http: client: Close output channel on decoder EOF
Matt Bell committed
Dec 17, 2014 at 18:41 UTC
5d3bc652cbf12000db24df4e48af63304dc95455
1 file changed
+6
-4
commands/http/client.go
+6
-4
@@ -150,10 +150,12 @@ func getResponse(httpRes *http.Response, req cmds.Request) (cmds.Response, error
150
151
for {
152
err := dec.Decode(&v)
153
- if err != nil {
154
- if err != io.EOF {
155
- fmt.Println(err.Error())
156
- }
153
+ if err != nil && err != io.EOF {
154
+ fmt.Println(err.Error())
155
+ return
156
+ }
157
+ if err == io.EOF {
158
+ close(outChan)
159
return
160
}
161
outChan <- v