Go
Go
Transition from Http.PBinaryBd to Http.HttpBd
Provides instructions for replacing deprecated PBinaryBd method calls with HttpBd.Chilkat Go Downloads
success := false
http := chilkat.NewHttp()
verb := "POST"
url := "https://example.com/"
bdRequestBody := chilkat.NewBinData()
contentType := "application/octet-stream"
// ------------------------------------------------------------------------
// The PBinaryBd method is deprecated:
responseObj := http.PBinaryBd(verb,url,bdRequestBody,contentType,false,false)
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
bdRequestBody.DisposeBinData()
return
}
// ...
// ...
responseObj.DisposeHttpResponse()
// ------------------------------------------------------------------------
// Do the equivalent using HttpBd.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
responseOut := chilkat.NewHttpResponse()
success = http.HttpBd(verb,url,bdRequestBody,contentType,responseOut)
if success == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
bdRequestBody.DisposeBinData()
responseOut.DisposeHttpResponse()
return
}
http.DisposeHttp()
bdRequestBody.DisposeBinData()
responseOut.DisposeHttpResponse()