Sample code for 30+ languages & platforms
Go

Transition from Http.PostBinary to Http.HttpBinary

Provides instructions for replacing deprecated PostBinary method calls with HttpBinary.

Chilkat Go Downloads

Go
    success := false

    http := chilkat.NewHttp()

    verb := "POST"
    url := "https://example.com/"
    var byteData []byte
    contentType := "application/octet-stream"

    // ------------------------------------------------------------------------
    // The PostBinary method is deprecated:

    responseBody := http.PostBinary(url,byteData,contentType,false,false)
    if http.LastMethodSuccess() == false {
        fmt.Println(http.LastErrorText())
        http.DisposeHttp()
        return
    }

    // ...
    // ...

    // ------------------------------------------------------------------------
    // Do the equivalent using HttpBinary.

    responseOut := chilkat.NewHttpResponse()
    success = http.HttpBinary(verb,url,byteData,contentType,responseOut)
    if success == false {
        fmt.Println(http.LastErrorText())
        http.DisposeHttp()
        responseOut.DisposeHttpResponse()
        return
    }

    *responseBody = responseOut.BodyStr()

    http.DisposeHttp()
    responseOut.DisposeHttpResponse()