Xbase++
Xbase++
Inspect HTTP Request Header
Demonstrates theLastHeader property.
Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL cUrl
LOCAL cJson
LOCAL oResp
nSuccess := 0
oHttp := CreateObject("Chilkat.Http")
cUrl := "https://chilkatsoft.com/echo_request_body.asp"
cJson := '{"greeting":"Hello World"}'
// Send a POST with the JSON in the HTTP request body.
oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpStr("POST", cUrl, cJson, "utf-8", "application/json", oResp)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oResp:destroy()
RETURN
ENDIF
// Examine the HTTP request header we just sent.
? oHttp:LastHeader
// Output:
// POST /echo_request_body.asp HTTP/1.1
// Host: chilkatsoft.com
// Accept: */*
// Accept-Encoding: gzip
// Content-Type: application/json
// Content-Length: 26
oHttp:destroy()
oResp:destroy()