From 2ef530daa47b301a40c1ee93cd43b8f36fc68c0b Mon Sep 17 00:00:00 2001 From: tjpcc Date: Tue, 17 Jan 2023 15:59:29 -0700 Subject: pull request, response, handlers out of the gemini package --- examples/fetch/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/fetch') diff --git a/examples/fetch/main.go b/examples/fetch/main.go index adfece4..109a042 100644 --- a/examples/fetch/main.go +++ b/examples/fetch/main.go @@ -8,6 +8,7 @@ import ( "os" "strings" + "tildegit.org/tjp/gus" "tildegit.org/tjp/gus/gemini" ) @@ -29,20 +30,21 @@ func main() { } // parse the URL and build the request - request := &gemini.Request{URL: buildURL()} + request := &gus.Request{URL: buildURL()} // fetch the response response, err := client.RoundTrip(request) if err != nil { log.Fatal(err) } + defer response.Close() if response.Status != gemini.StatusSuccess { log.Fatalf("%d %s\n", response.Status, response.Meta) } //io.Copy(os.Stdout, response) - buf, err := io.ReadAll(response) + buf, err := io.ReadAll(gemini.NewResponseReader(response)) fmt.Printf("response: %s\n", buf) } -- cgit v1.2.3