Skip to content

Instantly share code, notes, and snippets.

@KentaKudo
Created January 20, 2019 15:21
Show Gist options
  • Save KentaKudo/3a114fa7fd273c41c0970d4184467446 to your computer and use it in GitHub Desktop.
Save KentaKudo/3a114fa7fd273c41c0970d4184467446 to your computer and use it in GitHub Desktop.
Go Code Snippet: http.Get
func (c *Client) Get(url string) (string, error) {
resp, err := c.cli.Get(url)
if err != nil {
return "", err
}
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(b), nil
}
@KentaKudo
Copy link
Author

Code snippet to read http response body at a time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment