I want to get the content length of a page using GO net/http? I can do this in terminal using curl -i -X HEAD https://golang.org
and then check the content-length field.
use http.Head()
res, err := http.Head("https://golang.org")
if err != nil {
panic(err)
}
contentlength:=res.ContentLength
fmt.Printf("ContentLength:%v",contentlength)