1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
module;
#include <boost/beast/http/message.hpp>
#include <boost/beast/http/verb.hpp>
export module routemon:req_ctx;
import :http.common;
import :trace;
namespace routemon {
export class req_ctx {
trace::id tid_;
std::locale locale_;
http::verb_set route_verbs_;
bool keep_alive_;
bhttp::request_header<bhttp::fields> const& req_header_;
public:
explicit req_ctx(trace::id tid, std::locale locale, http::verb_set route_verbs, bool keep_alive, bhttp::request_header<bhttp::fields> const& req_header)
: tid_{tid}, locale_{locale}, route_verbs_{route_verbs}, keep_alive_{keep_alive}, req_header_{req_header}
{}
template<typename ReqBody>
explicit req_ctx(trace::id tid, std::locale locale, http::verb_set route_verbs, bhttp::request<ReqBody> const& req)
: req_ctx{tid, locale, route_verbs, req.keep_alive(), req.base()}
{}
auto trace_id() const -> trace::id {
return tid_;
}
auto locale() const -> std::locale {
return locale_;
}
auto route_verbs() const -> http::verb_set {
return route_verbs_;
}
auto keep_alive() const -> bool {
return keep_alive_;
}
auto req_header() const -> bhttp::request_header<bhttp::fields> const& {
return req_header_;
}
};
} // namespace routemon
|