Axmol Engine 2.4.0-258ceca
Loading...
Searching...
No Matches
HttpResponse Class Reference

defines the object which users will receive at onHttpCompleted(sender, HttpResponse) callback. More...

#include <HttpResponse.h>

Public Member Functions

 HttpResponse (HttpRequest *request)
 Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually.
 
virtual ~HttpResponse ()
 Destructor, it will be called in HttpClient internal.
 
ax::Objectautorelease ()
 Override autorelease method to prevent developers from calling it.
 
HttpRequestgetHttpRequest () const
 Get the corresponding HttpRequest object which leads to this response.
 
yasio::sbyte_buffer * getResponseData ()
 Get the http response data.
 
int getResponseCode () const
 Get the http response code to judge whether response is successful or not.
 

Detailed Description

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.

Since
v2.0.2. @lua NA

Constructor & Destructor Documentation

◆ HttpResponse()

HttpResponse ( HttpRequest * request)
inline

Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually.

Parameters
requestthe corresponding HttpRequest which leads to this response.

◆ ~HttpResponse()

virtual ~HttpResponse ( )
inlinevirtual

Destructor, it will be called in HttpClient internal.

Users don't need to destruct HttpResponse object manually.

Member Function Documentation

◆ autorelease()

ax::Object * autorelease ( )
inline

Override autorelease method to prevent developers from calling it.

If this method is called , it would trigger AXASSERT.

Returns
ax::Object* always return nullptr.

◆ getHttpRequest()

HttpRequest * getHttpRequest ( ) const
inline

Get the corresponding HttpRequest object which leads to this response.

There's no paired setter for it, because it's already set in class constructor

Returns
HttpRequest* the corresponding HttpRequest object which leads to this response.

◆ getResponseData()

yasio::sbyte_buffer * getResponseData ( )
inline

Get the http response data.

Returns
yasio::sbyte_buffer* the pointer that point to the _responseData.

◆ getResponseCode()

int getResponseCode ( ) const
inline

Get the http response code to judge whether response is successful or not.

I know that you want to see the _responseCode is 200. If _responseCode is not 200, you should check the meaning for _responseCode by the net.

Returns
int32_t the value of _responseCode

The documentation for this class was generated from the following file: