B4X
B4X
Inspect HTTP Request Header
Demonstrates theLastHeader property.
Chilkat B4X Downloads
Dim success As Boolean = False
Dim http As ChilkatHttp
http.Initialize("http")
Dim url As String = "https://chilkatsoft.com/echo_request_body.asp"
Dim json As String = "{" & Chr(34) & "greeting" & Chr(34) & ":" & Chr(34) & "Hello World" & Chr(34) & "}"
' Send a POST with the JSON in the HTTP request body.
Dim resp As ChilkatHttpResponse
resp.Initialize
success = http.HttpStr("POST", url, json, "utf-8", "application/json", resp)
If success = False Then
Log(http.LastErrorText)
Return
End If
' Examine the HTTP request header we just sent.
Log(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