userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
task_inherited_request.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/server/request/task_inherited_request.hpp
4
/// @brief Functions that provide access to HttpRequest stored in
5
/// TaskInheritedVariable.
6
7
#
include
<
ranges
>
8
#
include
<
string
>
9
#
include
<
string_view
>
10
11
#
include
<
boost
/
container
/
small_vector
.
hpp
>
12
13
#
include
<
userver
/
http
/
header_map
.
hpp
>
14
15
USERVER_NAMESPACE_BEGIN
16
17
namespace
http::
headers
{
18
class
PredefinedHeader;
19
}
// namespace http::headers
20
21
namespace
server::
request
{
22
23
struct
Header
{
24
std::string_view name;
25
std::string value;
26
27
Header(std::string_view name, std::string value)
28
: name(name),
29
value(std::move(value))
30
{}
31
};
32
33
using
HeadersToPropagate = boost::container::small_vector<
Header
, 10>;
34
35
/// @brief Get a header from server::http::HttpRequest that is handled by the
36
/// current task hierarchy.
37
/// @return Header value or an empty string, if none such
38
const
std::string&
GetPropagatedHeader
(std::string_view header_name);
39
40
/// @overload
41
const
std::string&
GetPropagatedHeader
(
const
USERVER_NAMESPACE::http::
headers
::PredefinedHeader& header_name);
42
43
/// @brief Checks whether specified header exists in server::http::HttpRequest
44
/// that is handled by the current task hierarchy.
45
/// @return `true` if the header exists, `false` otherwise
46
bool
HasPropagatedHeader
(std::string_view header_name);
47
48
/// @overload
49
bool
HasPropagatedHeader
(
const
USERVER_NAMESPACE::http::
headers
::PredefinedHeader& header_name);
50
51
/// @brief Get a headers that is handled by the current task hierarchy.
52
std::ranges::subrange<HeadersToPropagate::const_iterator>
GetPropagatedHeaders
();
53
54
/// @brief Set a headers that is handled by the current task hierarchy.
55
void
SetPropagatedHeaders
(HeadersToPropagate headers);
56
57
/// @brief Get a query parameter from server::http::HttpRequest that is handled
58
/// by the current task hierarchy.
59
/// @return Parameter value or an empty string, if none such
60
const
std::string&
GetTaskInheritedQueryParameter
(std::string_view name);
61
62
/// @brief Checks whether specified query parameter exists in
63
/// server::http::HttpRequest that is handled by the current task hierarchy.
64
/// @return `true` if the parameter exists, `false` otherwise
65
bool
HasTaskInheritedQueryParameter
(std::string_view name);
66
67
}
// namespace server::request
68
69
USERVER_NAMESPACE_END
userver
server
request
task_inherited_request.hpp
Generated on
for userver by
Doxygen
1.17.0