10Duke Scale C++ Client
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
10namespace tenduke { namespace http {
11
15{
16public:
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
66private:
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
A HTTP Response.
Definition HTTPResponse.h:15
virtual std::size_t getPayloadLength()
Returns length of the response entity /payload).
Definition HTTPResponse.cpp:51
virtual std::string getContentType()
Returns response content type.
Definition HTTPResponse.cpp:33
int getStatusCode() const
Returns the HTTP-status code.
Definition HTTPResponse.h:58
bool isSuccessful() const
Checks if the request is successful based on the HTTP status code.
Definition HTTPResponse.cpp:27
virtual std::string getPayloadAsString()
Returns the response entity (payload) as string.
Definition HTTPResponse.cpp:45
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7