Class CCHttpResponse

#include <Geode/cocos/extensions/network/HttpResponse.h>
classCCHttpResponse:publiccocos2d::CCObject{ ... }

Since v2.0.2

defines the object which users will receive at onHttpCompleted(sender, HttpResponse) callback Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClientTest.cpp as a sample

Examples0
Public static methods0
Public member functions12
cocos2d::CCObject*autorelease()

Override autorelease method to prevent developers from calling it

cocos2d::extension::CCHttpRequest*getHttpRequest()

Get the corresponding HttpRequest object which leads to this response There’s no paired setter for it, coz it’s already setted in class constructor

boolisSucceed()

To see if the http reqeust is returned successfully, Althrough users can judge if (http return code = 200), we want an easier way If this getter returns false, you can call getResponseCode and getErrorBuffer to find more details

std::vector<char>*getResponseData()

Get the http response raw data

std::vector<char>*getResponseHeader()

get the Rawheader *

intgetResponseCode()

Get the http response errorCode I know that you want to see http 200 :)

charconst*getErrorBuffer()

Get the rror buffer which will tell you more about the reason why http request failed

voidsetSucceed(
boolvalue
)

Set if the http request is returned successfully, Althrough users can judge if (http code == 200), we want a easier way This setter is mainly used in CCHttpClient, users mustn’t set it directly

voidsetResponseData()

Set the http response raw buffer, is used by CCHttpClient

voidsetResponseHeader()

Set the http response Header raw buffer, is used by CCHttpClient

voidsetResponseCode(
intvalue
)

Set the http response errorCode

voidsetErrorBuffer()

Set the error buffer which will tell you more the reason why http request failed

Fields6
;
No description provided
bool_succeed
;

the corresponding HttpRequest pointer who leads to this response

std::vector<char>_responseData
;

to indecate if the http reqeust is successful simply

std::vector<char>_responseHeader
;

the returned raw data. You can also dump it as a string

int_responseCode
;

the returned raw header data. You can also dump it as a string

gd::string_errorBuffer
;

the status code returned from libcurl, e.g. 200, 404

Protected member functions1
boolinitWithRequest()
No description provided
Protected fields0