Sample code for 30+ languages & platforms
Chilkat2-Python

Inspect HTTP Request Header

Demonstrates the LastHeader property.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

http = chilkat2.Http()

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

# Send a POST with the JSON in the HTTP request body.
resp = chilkat2.HttpResponse()
success = http.HttpStr("POST",url,json,"utf-8","application/json",resp)
if (success == False):
    print(http.LastErrorText)
    sys.exit()

# Examine the HTTP request header we just sent.
print(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