Sample code for 30+ languages & platforms
Objective-C

Inspect HTTP Request Header

Demonstrates the LastHeader property.

Chilkat Objective-C Downloads

Objective-C
#import <CkoHttp.h>
#import <NSString.h>
#import <CkoHttpResponse.h>

BOOL success = NO;

CkoHttp *http = [[CkoHttp alloc] init];

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

//  Send a POST with the JSON in the HTTP request body.
CkoHttpResponse *resp = [[CkoHttpResponse alloc] init];
success = [http HttpStr: @"POST" url: url bodyStr: json charset: @"utf-8" contentType: @"application/json" response: resp];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

//  Examine the HTTP request header we just sent.
NSLog(@"%@",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