Sample code for 30+ languages & platforms
Go

Transition from Http.PBinary to Http.HttpBinary

See more HTTP Examples

Provides instructions for replacing deprecated PBinary 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 PBinary method is deprecated:

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

    // ...
    // ...

    responseObj.DisposeHttpResponse()

    // ------------------------------------------------------------------------
    // Do the equivalent using HttpBinary.
    // Your application creates a new, empty HttpResponse object which is passed 
    // in the last argument and filled upon success.

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


    http.DisposeHttp()
    responseOut.DisposeHttpResponse()