summaryrefslogtreecommitdiff
path: root/examples/fetch
diff options
context:
space:
mode:
Diffstat (limited to 'examples/fetch')
-rw-r--r--examples/fetch/main.go6
1 files changed, 4 insertions, 2 deletions
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)
}