10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
HTTPResponse Class Reference

#include <HTTPResponse.h>

Detailed Description

A HTTP Response.

Public Member Functions

 HTTPResponse (int statusCode, std::multimap< std::string, std::string > headers, std::unique_ptr< tenduke::utl::BinaryData > data)
 Constructs new instance.
 HTTPResponse (const HTTPResponse &original)
 Copy-constructs new instance.
virtual std::string getContentType ()
 Returns response content type.
std::string getHeader (const std::string &name) const
 Returns value of a response header.
virtual std::string getPayloadAsString ()
 Returns the response entity (payload) as string.
virtual std::size_t getPayloadLength ()
 Returns length of the response entity /payload).
int getStatusCode () const
 Returns the HTTP-status code.
bool isSuccessful () const
 Checks if the request is successful based on the HTTP status code.

Constructor & Destructor Documentation

◆ HTTPResponse() [1/2]

tenduke::http::HTTPResponse::HTTPResponse ( int statusCode,
std::multimap< std::string, std::string > headers,
std::unique_ptr< tenduke::utl::BinaryData > data )

Constructs new instance.

Parameters
statusCode-
headers-
data-

◆ HTTPResponse() [2/2]

Copy-constructs new instance.

Parameters
original-

Member Function Documentation

◆ getContentType()

Returns response content type.

Returns
-

◆ getHeader()

std::string tenduke::http::HTTPResponse::getHeader ( const std::string & name) const

Returns value of a response header.

Header names are case-insensitive.

Parameters
namethe header name
Returns
value of the first header with the name, or empty string if the response does not have the header

◆ getPayloadAsString()

Returns the response entity (payload) as string.

Returns
-

◆ getPayloadLength()

Returns length of the response entity /payload).

Returns
-

◆ getStatusCode()

Returns the HTTP-status code.

Returns
the HTTP-status code

◆ isSuccessful()

Checks if the request is successful based on the HTTP status code.

Returns
true if the HTTP status code is 2xx. Redirects (3xx) are not successful, because they are not followed.

The documentation for this class was generated from the following files:
  • core/core/src/http/HTTPResponse.h
  • core/core/src/http/HTTPResponse.cpp