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
48
std::string
getHeader
(
const
std::string &name)
const
;
49
54
virtual
std::string
getPayloadAsString
();
59
virtual
std::size_t
getPayloadLength
();
60
65
int
getStatusCode
()
const
{
return
statusCode;}
66
72
bool
isSuccessful
()
const
;
73
74
private
:
75
const
int
statusCode;
76
const
std::multimap<std::string, std::string> headers;
77
const
std::unique_ptr<tenduke::utl::BinaryData> data;
78
};
79
80
}}
81
82
#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::getHeader
std::string getHeader(const std::string &name) const
Returns value of a response header.
Definition
HTTPResponse.cpp:39
tenduke::http::HTTPResponse::getPayloadLength
virtual std::size_t getPayloadLength()
Returns length of the response entity /payload).
Definition
HTTPResponse.cpp:57
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:65
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:51
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