diff options
| author | Adnan Maolood <[email protected]> | 2020-10-27 19:21:33 -0400 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2020-10-27 19:22:34 -0400 |
| commit | 239ec885f7ff4c82195527543fe9fa79186ee405 (patch) | |
| tree | 136fcc482be539f313ba37a4d8c01688787cc546 /examples | |
| parent | Make (*Response).Body an io.ReadCloser (diff) | |
| download | go-gemini-239ec885f7ff4c82195527543fe9fa79186ee405.tar.xz go-gemini-239ec885f7ff4c82195527543fe9fa79186ee405.zip | |
Add (*Client).Get function
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/client.go | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/examples/client.go b/examples/client.go index fa88dcf..16608ca 100644 --- a/examples/client.go +++ b/examples/client.go @@ -68,7 +68,7 @@ func init() { // sendRequest sends a request to the given URL. func sendRequest(req *gmi.Request) error { - resp, err := client.Send(req) + resp, err := client.Do(req) if err != nil { return err } @@ -149,19 +149,8 @@ func main() { os.Exit(1) } - var host string - if len(os.Args) >= 3 { - host = os.Args[2] - } - url := os.Args[1] - var req *gmi.Request - var err error - if host != "" { - req, err = gmi.NewRequestTo(url, host) - } else { - req, err = gmi.NewRequest(url) - } + req, err := gmi.NewRequest(url) if err != nil { fmt.Println(err) os.Exit(1) |