I need a simple example where we POST some HTTP request to the server. And also i need to add some headers to that HTTP post. I have tried posting the HTTP post, but little confused about adding headers in the request. Is there any mandatory field/HEADER i have to add in the HTTP Post ??
Suppose you have an NSURLRequest called theRequest.
You configure the request type to POST with
[theRequest setHTTPMethod:@"POST"];
And for the headers, you add values to the Header you add them as key value pairs:
[theRequest setValue:authorizationString forKey:@"Authorization"];
which sets authorizationString for the Authorization header.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With