Go
Go
Transition from Http.GetHead to Http.HttpNoBody
Provides instructions for replacing deprecated GetHead method calls with HttpNoBody.Chilkat Go Downloads
success := false
http := chilkat.NewHttp()
url := "https://www.example.com/"
// ------------------------------------------------------------------------
// The GetHead method is deprecated:
resp1 := http.GetHead(url)
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
return
}
fmt.Println(resp1.StatusCode())
resp1.DisposeHttpResponse()
// ------------------------------------------------------------------------
// Do the equivalent using HttpNoBody.
// Your application creates a new, empty response object which is passed
// in the last argument and filled with the HTTP response upon success.
resp2 := chilkat.NewHttpResponse()
success = http.HttpNoBody("HEAD",url,resp2)
if success == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
resp2.DisposeHttpResponse()
return
}
fmt.Println(resp2.StatusCode())
http.DisposeHttp()
resp2.DisposeHttpResponse()