Sample code for 30+ languages & platforms
Unicode C++

Inspect HTTP Request Header

Demonstrates the LastHeader property.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkHttpW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkHttpW http;

    const wchar_t *url = L"https://chilkatsoft.com/echo_request_body.asp";
    const wchar_t *json = L"{\"greeting\":\"Hello World\"}";

    //  Send a POST with the JSON in the HTTP request body.
    CkHttpResponseW resp;
    success = http.HttpStr(L"POST",url,json,L"utf-8",L"application/json",resp);
    if (success == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    //  Examine the HTTP request header we just sent.
    wprintf(L"%s\n",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
    }