0
Do you support Syntax Highlighting? Yes!
package main
import (
"log"
"net/http"
"io/ioutil"
)
func main() {
resp, err := http.Get("https://www.google.com")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
log.Printf(string(bodyBytes))
}
}
4 years ago