mirror of https://github.com/axmolengine/axmol.git
apply custom request header for every request type (ios)
This commit is contained in:
parent
4de2e6b9bf
commit
e33854f3eb
|
@ -167,13 +167,6 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
|
|||
//set request type
|
||||
[nsrequest setHTTPMethod:requestType];
|
||||
|
||||
//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())
|
||||
|
@ -191,6 +184,14 @@ 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"];
|
||||
}
|
||||
|
||||
char* requestDataBuffer = request->getRequestData();
|
||||
if (nullptr != requestDataBuffer && 0 != strlen(requestDataBuffer))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue