-
Phil Richards authored
Used to read all the bytes held by an io.Reader into bytes.Buffer, and call Close on the reader if it implements it. It also checks to see if the provided Reader is actually already a bytes.Buffer, and returns a new instance based on the same backing slice as an efficient shortcut if so. This is there because there are a few places we try to rewind the body of an http request, and this is a convenient way to wrap it. Also moved TryClose from the commands package to this one, ioutils.
b9892210