response: Document zero-result Decode behaviour
This commit was moved from ipfs/go-ipfs-http-client@902bc5ef8c1b9595e97728dca3da0d0da124f142
Łukasz Magiera committed
Feb 19, 2019 at 22:27 UTC
a058e7d31a32d1bca98e41886a310149b872af84
1 file changed
+3
client/httpapi/response.go
+3
@@ -71,6 +71,9 @@ func (r *Response) Decode(dec interface{}) error {
71
}
72
n++
73
}
74
+
75
+ // Decode expects at least one result. For calls where zero results are valid,
76
+ // use Send and construct json Decoder manually.
77
if n > 0 && err == io.EOF {
78
err = nil
79
}