roar
Loading...
Searching...
No Matches
standard_text_response_provider.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace Roar
6{
11 {
12 public:
13 boost::beast::http::response<boost::beast::http::string_body>
14 makeStandardResponse(Session&, boost::beast::http::status status, std::string_view additionalInfo) const
15 {
16 auto res = boost::beast::http::response<boost::beast::http::string_body>(status, 11);
17 res.set(boost::beast::http::field::content_type, "text/html");
18 res.set(boost::beast::http::field::connection, "close");
19 if (status != boost::beast::http::status::no_content)
20 res.body() = std::string{obsolete_reason(status)} + "\n" + std::string{additionalInfo};
21 res.prepare_payload();
22 return res;
23 }
24 };
25}
Definition session.hpp:41
Implement your own StandardResponseProvider to make custom 404 pages etc.
Definition standard_response_provider.hpp:21
This standard response provider implementation produces very simple text responses.
Definition standard_text_response_provider.hpp:11
boost::beast::http::response< boost::beast::http::string_body > makeStandardResponse(Session &, boost::beast::http::status status, std::string_view additionalInfo) const
Definition standard_text_response_provider.hpp:14
Definition authorization.hpp:10