Sample code for 30+ languages & platforms
Go

Inspect HTTP Request Header

Demonstrates the LastHeader property.

Chilkat Go Downloads

Go
    success := false

    http := chilkat.NewHttp()

    url := "https://chilkatsoft.com/echo_request_body.asp"
    json := "{\"greeting\":\"Hello World\"}"

    // Send a POST with the JSON in the HTTP request body.
    resp := chilkat.NewHttpResponse()
    success = http.HttpStr("POST",url,json,"utf-8","application/json",resp)
    if success == false {
        fmt.Println(http.LastErrorText())
        http.DisposeHttp()
        resp.DisposeHttpResponse()
        return
    }

    // Examine the HTTP request header we just sent.
    fmt.Println(http.LastHeader())

    // Output:

    // POST /echo_request_body.asp HTTP/1.1
    // Host: chilkatsoft.com
    // Accept: */*
    // Accept-Encoding: gzip
    // Content-Type: application/json
    // Content-Length: 26

    http.DisposeHttp()
    resp.DisposeHttpResponse()