From 724979970b3fa76e8992ab84c7f7991d605cb6e5 Mon Sep 17 00:00:00 2001 From: Ian Henderson Date: Thu, 22 Oct 2020 14:32:56 -0700 Subject: [PATCH] expose the response connection as an io.ReadCloser (like net/http does) (#15) --- gopher.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gopher.go b/gopher.go index 9e78db7..c1e9171 100644 --- a/gopher.go +++ b/gopher.go @@ -293,7 +293,7 @@ func (d *Directory) ToText() ([]byte, error) { type Response struct { Type ItemType Dir Directory - Body io.Reader + Body io.ReadCloser } // Get fetches a Gopher resource by URI @@ -369,7 +369,7 @@ func Get(uri string) (*Response, error) { // FetchFile fetches data, not directory information. // Calling this on a DIRECTORY Item type // or unsupported type will return an error. -func (i *Item) FetchFile() (io.Reader, error) { +func (i *Item) FetchFile() (io.ReadCloser, error) { if i.Type == DIRECTORY { return nil, errors.New("cannot fetch a directory as a file") }