ByteReadCloser returns a ReadCloser either by returning the io.ReadCloser r if it implements the interface, or wrapping it with a ReadByte method.
(r io.ReadCloser)
| 60 | // ByteReadCloser returns a ReadCloser either by returning the io.ReadCloser |
| 61 | // r if it implements the interface, or wrapping it with a ReadByte method. |
| 62 | func ByteReadCloser(r io.ReadCloser) ReadCloser { |
| 63 | if rc, ok := r.(ReadCloser); ok { |
| 64 | return rc |
| 65 | } |
| 66 | |
| 67 | return &byteReadCloser{r} |
| 68 | } |