http.Get doesn't work with default transport, but works fine if I set a custom
as following(uncomment the two lines)
package main
import (
"net/http"
"io/ioutil"
"fmt"
"log"
)
func main() {
//tr := &http.Transport{}
//http.DefaultClient.Transport =tr
res, err:= http.Get("https://www.github.com/")
if err != nil {
log.Fatal(err)
return
}
defer res.Body.Close()
body,err:=ioutil.ReadAll(res.Body)
if err != nil {
log.Fatal(err)
return
}
fmt.Println(string(body))
}
There is an error with less meaning:
Get https://www.github.com/: unexpected EOF
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.