Sample code for 30+ languages & platforms
C#

Inspect HTTP Request Header

Demonstrates the LastHeader property.

Chilkat C# Downloads

C#
bool success = false;

Chilkat.Http http = new Chilkat.Http();

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

//  Send a POST with the JSON in the HTTP request body.
Chilkat.HttpResponse resp = new Chilkat.HttpResponse();
success = http.HttpStr("POST",url,json,"utf-8","application/json",resp);
if (success == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

//  Examine the HTTP request header we just sent.
Debug.WriteLine(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