(Go) HTTP DELETE with Body
Demonstrates how to send a DELETE request with a body. Note: This example requires Chilkat v11.0.0 or greater.
success := false
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := Http_Ref.html">chilkat.NewHttp()
// Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
requestBody := "{ \"abc\": 123 }"
resp := HttpResponse_Ref.html">chilkat.NewHttpResponse()
success = http.HttpStr("DELETE","https://example.com/something",requestBody,"utf-8","application/json",resp)
if success == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
resp.DisposeHttpResponse()
return
}
fmt.Println("Response status: ", resp.StatusCode())
fmt.Println("Response body: ")
fmt.Println(resp.BodyStr())
http.DisposeHttp()
resp.DisposeHttpResponse()
|