Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
Response.hpp
1
#pragma once
2
3
#include "web/ng/Request.hpp"
4
5
#include <boost/asio/buffer.hpp>
6
#include <boost/beast/http/message.hpp>
7
#include <boost/beast/http/status.hpp>
8
#include <boost/beast/http/string_body.hpp>
9
#include <boost/json/object.hpp>
10
11
#include <string>
12
#include <variant>
13
14
namespace
web::ng {
15
16
class
Connection
;
17
21
class
Response
{
22
public
:
23
std::variant<boost::beast::http::response<boost::beast::http::string_body>, std::string>
data
;
24
25
public
:
34
Response
(boost::beast::http::status status, std::string
message
,
Request
const
& request);
35
44
Response
(
45
boost::beast::http::status status,
46
boost::json::object
const
&
message
,
47
Request
const
& request
48
);
49
58
Response
(
59
boost::beast::http::status status,
60
boost::json::object
const
&
message
,
61
Connection
const
& connection
62
);
63
72
Response
(boost::beast::http::status status, std::string
message
,
Connection
const
& connection);
73
80
Response
(
81
boost::beast::http::response<boost::beast::http::string_body> response,
82
Request
const
& request
83
);
84
90
[[nodiscard]] std::string
const
&
91
message
()
const
;
92
98
void
99
setMessage
(std::string newMessage);
100
106
void
107
setMessage
(boost::json::object
const
& newMessage);
108
115
boost::beast::http::response<boost::beast::http::string_body>
116
intoHttpResponse
() &&;
117
124
[[nodiscard]] boost::asio::const_buffer
125
asWsResponse
()
const
&;
126
};
127
128
}
// namespace web::ng
web::ng::Connection
A class representing a connection to a client.
Definition
Connection.hpp:114
web::ng::Request
Represents an HTTP or WebSocket request.
Definition
Request.hpp:18
web::ng::Response::Response
Response(boost::beast::http::status status, std::string message, Request const &request)
Construct a Response from string. Content type will be text/html.
Definition
Response.cpp:96
web::ng::Response::intoHttpResponse
boost::beast::http::response< boost::beast::http::string_body > intoHttpResponse() &&
Convert the Response to an HTTP response.
Definition
Response.cpp:189
web::ng::Response::asWsResponse
boost::asio::const_buffer asWsResponse() const &
Get the message of the response as a const buffer.
Definition
Response.cpp:200
web::ng::Response::message
std::string const & message() const
Get the message of the response.
Definition
Response.cpp:139
web::ng::Response::setMessage
void setMessage(std::string newMessage)
Replace existing message (or body) with new message.
Definition
Response.cpp:155
data
This namespace implements the data access layer and related components.
Definition
AmendmentCenter.cpp:56
src
web
ng
Response.hpp
Generated by
1.17.0