Im using TTURLRequest
from the cocoa Three20 development library to form a post request.
I'm setting the http headers with this:
[request setValue:VALUE forHTTPHeaderField:KEY];
I'm getting a 400 response back. I'm also using Charles to capture the requests and responses. The request is getting out (with the headers I had put in) so obviously I'm not forming the headers correctly or I'm missing some important ones.
The Headers I am setting are:
[request setValue:@"0"
forHTTPHeaderField:@"Content-Length"];//0 length?(not sending any raw data)
[request setValue:authorizationHeader
forHTTPHeaderField:@"Authorization"];
[request setValue:@"CUSTOM/1.0"
forHTTPHeaderField:@"User-Agent"];
[request setValue:@"application/x-www-form-urlencoded"
forHTTPHeaderField:@"Content-Type"];
What is the correct syntax and order of http headers in a post request?