Closed danteu closed 1 year ago
Why is this needed?
Why is this needed?
By snappy.Reader satisfying the io.ReadCloser interface, it can now be used for http.Request.Body which allows handling snappy-encoded HTTP bodies. One particular use case I'm interested in is described in https://github.com/prometheus/pushgateway/issues/441
There's nothing to actually close, though, so I don't think it makes sense to implement Closer.
More subtly, if the underlying io.Reader is a ReadCloser, it's error-prone that the snappy Reader.Close doesn't close the underlying reader.
You can use io.NopCloser to wrap the snappy Reader in cases where you need to use it as a ReadCloser.
Makes sense, thanks for the quick reply.
This patch implements Reader.Close, which satisfies the io.Closer interface. Reader now, in turn, satisfies the io.ReadCloser interface.