Set default value for `Content-Type` of headfield in `PUT` method

This commit is contained in:
samuele3hu 2015-01-31 22:15:15 +08:00
parent 75dc45bfea
commit fec0d9c41d
1 changed files with 4 additions and 0 deletions

View File

@ -170,6 +170,10 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
//if request type is post or put,set header and data
if([requestType isEqual: @"POST"] || [requestType isEqual: @"PUT"])
{
if ([requestType isEqual: @"PUT"])
{
[nsrequest setValue: @"application/x-www-form-urlencoded" forHTTPHeaderField: @"Content-Type"];
}
/* get custom header data (if set) */
std::vector<std::string> headers=request->getHeaders();
if(!headers.empty())