mirror of https://github.com/axmolengine/axmol.git
Merge pull request #10315 from samuele3hu/v3_4_rc1
Fix the error that the binary data would be truncated
This commit is contained in:
commit
173578cf41
|
@ -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())
|
||||
|
@ -190,8 +194,7 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
|
|||
char* requestDataBuffer = request->getRequestData();
|
||||
if (nullptr != requestDataBuffer && 0 != strlen(requestDataBuffer))
|
||||
{
|
||||
NSString* requestData = [NSString stringWithUTF8String:requestDataBuffer];
|
||||
NSData *postData = [requestData dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSData *postData = [NSData dataWithBytes:requestDataBuffer length:request->getRequestDataSize()];
|
||||
[nsrequest setHTTPBody:postData];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue