(Tcl) Inspect HTTP Request Header
Demonstrates the LastHeader property.
load ./chilkat.dll
set success 0
set http [new_CkHttp]
set url "https://chilkatsoft.com/echo_request_body.asp"
set json "{\"greeting\":\"Hello World\"}"
# Send a POST with the JSON in the HTTP request body.
set resp [new_CkHttpResponse]
set success [CkHttp_HttpStr $http "POST" $url $json "utf-8" "application/json" $resp]
if {$success == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkHttpResponse $resp
exit
}
# Examine the HTTP request header we just sent.
puts [CkHttp_lastHeader $http]
# Output:
# POST /echo_request_body.asp HTTP/1.1
# Host: chilkatsoft.com
# Accept: */*
# Accept-Encoding: gzip
# Content-Type: application/json
# Content-Length: 26
delete_CkHttp $http
delete_CkHttpResponse $resp
|