(Go) Example: Http.HttpNoBody method
Demonstrates how to use the HttpNoBody method to send HTTP requests without a request body (e.g., GET, DELETE, HEAD) and receive the response in a Chilkat Http response object. Note: This example requires Chilkat v11.0.0 or greater.
success := false
http := Http_Ref.html">chilkat.NewHttp()
resp := HttpResponse_Ref.html">chilkat.NewHttpResponse()
// Send a DELETE request to https://api.example.com/users/123
url := "https://api.example.com/users/123"
success = http.HttpNoBody("DELETE",url,resp)
if success == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
resp.DisposeHttpResponse()
return
}
fmt.Println("Response Status Code: ", resp.StatusCode())
fmt.Println("Response body:")
fmt.Println(resp.BodyStr())
http.DisposeHttp()
resp.DisposeHttpResponse()
|