mirror of https://github.com/axmolengine/axmol.git
Fix the error that the binary data would be truncated
This commit is contained in:
parent
a1c8c615ac
commit
e6d50d7086
|
@ -164,6 +164,7 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
|
||||||
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
|
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
|
||||||
timeoutInterval:HttpClient::getInstance()->getTimeoutForConnect()];
|
timeoutInterval:HttpClient::getInstance()->getTimeoutForConnect()];
|
||||||
|
|
||||||
|
|
||||||
//set request type
|
//set request type
|
||||||
[nsrequest setHTTPMethod:requestType];
|
[nsrequest setHTTPMethod:requestType];
|
||||||
|
|
||||||
|
@ -190,8 +191,7 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
|
||||||
char* requestDataBuffer = request->getRequestData();
|
char* requestDataBuffer = request->getRequestData();
|
||||||
if (nullptr != requestDataBuffer && 0 != strlen(requestDataBuffer))
|
if (nullptr != requestDataBuffer && 0 != strlen(requestDataBuffer))
|
||||||
{
|
{
|
||||||
NSString* requestData = [NSString stringWithUTF8String:requestDataBuffer];
|
NSData *postData = [NSData dataWithBytes:requestDataBuffer length:request->getRequestDataSize()];
|
||||||
NSData *postData = [requestData dataUsingEncoding:NSUTF8StringEncoding];
|
|
||||||
[nsrequest setHTTPBody:postData];
|
[nsrequest setHTTPBody:postData];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue