(Visual FoxPro) Inspect HTTP Request Header
Demonstrates the LastHeader property.
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcUrl
LOCAL lcJson
LOCAL loResp
lnSuccess = 0
loHttp = CreateObject('Chilkat.Http')
lcUrl = "https://chilkatsoft.com/echo_request_body.asp"
lcJson = '{"greeting":"Hello World"}'
* Send a POST with the JSON in the HTTP request body.
loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpStr("POST",lcUrl,lcJson,"utf-8","application/json",loResp)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loResp
CANCEL
ENDIF
* Examine the HTTP request header we just sent.
? loHttp.LastHeader
* Output:
* POST /echo_request_body.asp HTTP/1.1
* Host: chilkatsoft.com
* Accept: */*
* Accept-Encoding: gzip
* Content-Type: application/json
* Content-Length: 26
RELEASE loHttp
RELEASE loResp
|