10Duke Enterprise C++ SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
HTTPResponse.h
1
#ifndef HTTPRESPONSE_H
2
#define HTTPRESPONSE_H
3
4
#include "utl/BinaryData.h"
5
6
#include <map>
7
#include <memory>
8
#include <string>
9
10
namespace
tenduke
{
namespace
http
{
11
14
class
HTTPResponse
15
{
16
public
:
23
HTTPResponse
(
24
int
statusCode,
25
std::multimap<std::string, std::string> headers,
26
std::unique_ptr<tenduke::utl::BinaryData> data
27
);
28
33
HTTPResponse
(
const
HTTPResponse
&original);
34
35
virtual
~HTTPResponse
() =
default
;
36
41
virtual
std::string
getContentType
();
42
47
virtual
std::string
getPayloadAsString
();
52
virtual
std::size_t
getPayloadLength
();
53
58
int
getStatusCode
()
const
{
return
statusCode;}
59
64
bool
isSuccessful
()
const
;
65
66
private
:
67
const
int
statusCode;
68
const
std::multimap<std::string, std::string> headers;
69
const
std::unique_ptr<tenduke::utl::BinaryData> data;
70
};
71
72
}}
73
74
#endif
// HTTPRESPONSE_H
HTTPResponse::HTTPResponse
HTTPResponse(int statusCode, std::multimap< std::string, std::string > headers, std::unique_ptr< tenduke::utl::BinaryData > data)
Constructs new instance.
Definition
HTTPResponse.cpp:11
tenduke::http::HTTPResponse::getPayloadLength
virtual std::size_t getPayloadLength()
Returns length of the response entity /payload).
Definition
HTTPResponse.cpp:51
tenduke::http::HTTPResponse::getContentType
virtual std::string getContentType()
Returns response content type.
Definition
HTTPResponse.cpp:33
tenduke::http::HTTPResponse::getStatusCode
int getStatusCode() const
Returns the HTTP-status code.
Definition
HTTPResponse.h:58
tenduke::http::HTTPResponse::HTTPResponse
HTTPResponse(int statusCode, std::multimap< std::string, std::string > headers, std::unique_ptr< tenduke::utl::BinaryData > data)
Constructs new instance.
Definition
HTTPResponse.cpp:11
tenduke::http::HTTPResponse::isSuccessful
bool isSuccessful() const
Checks if the request is successful based on the HTTP status code.
Definition
HTTPResponse.cpp:27
tenduke::http::HTTPResponse::getPayloadAsString
virtual std::string getPayloadAsString()
Returns the response entity (payload) as string.
Definition
HTTPResponse.cpp:45
tenduke::http
HTTP-related services.
Definition
BadRequest.h:6
tenduke
Root for classes, functions and globals of 10Duke C++ Client.
Definition
APIRequest.h:4
core
core
src
http
HTTPResponse.h
Generated by
1.17.0