summaryrefslogtreecommitdiff
path: root/examples/fetch/main.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-01-17 15:59:29 -0700
committertjpcc <tjp@ctrl-c.club>2023-01-17 15:59:29 -0700
commit2ef530daa47b301a40c1ee93cd43b8f36fc68c0b (patch)
treeb9753719f5f0e5312bb5008d40f40247ce14e15a /examples/fetch/main.go
parent30e21f8513d49661cb6e1583d301e34e898d48a9 (diff)
pull request, response, handlers out of the gemini package
Diffstat (limited to 'examples/fetch/main.go')
-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)
}