Sample code for 30+ languages & platforms
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.

Chilkat Go Downloads

Go
    success := false

    http := chilkat.NewHttp()
    resp := 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()