userver
C++ Async Framework
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
<
string
>
8
#
include
<
string_view
>
9
10
#
include
<
boost
/
container
/
small_vector
.
hpp
>
11
#
include
<
boost
/
range
/
iterator_range
.
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) : name(name), value(std::move(value)) {}
28
};
29
30
using
HeadersToPropagate
=
boost
::
container
::
small_vector
<
Header
, 10>;
31
32
/// @brief Get a header from server::http::HttpRequest that is handled by the
33
/// current task hierarchy.
34
/// @return Header value or an empty string, if none such
35
const
std::string&
GetPropagatedHeader
(std::string_view header_name);
36
37
/// @overload
38
const
std::string&
GetPropagatedHeader
(
const
USERVER_NAMESPACE::
http
::
headers
::PredefinedHeader& header_name);
39
40
/// @brief Checks whether specified header exists in server::http::HttpRequest
41
/// that is handled by the current task hierarchy.
42
/// @return `true` if the header exists, `false` otherwise
43
bool
HasPropagatedHeader
(std::string_view header_name);
44
45
/// @overload
46
bool
HasPropagatedHeader
(
const
USERVER_NAMESPACE::
http
::
headers
::PredefinedHeader& header_name);
47
48
/// @brief Get a headers that is handled by the current task hierarchy.
49
boost
::
iterator_range
<
HeadersToPropagate
::
const_iterator
>
GetPropagatedHeaders
();
50
51
/// @brief Set a headers that is handled by the current task hierarchy.
52
void
SetPropagatedHeaders
(HeadersToPropagate headers);
53
54
/// @brief Get a query parameter from server::http::HttpRequest that is handled
55
/// by the current task hierarchy.
56
/// @return Parameter value or an empty string, if none such
57
const
std::string&
GetTaskInheritedQueryParameter
(std::string_view name);
58
59
/// @brief Checks whether specified query parameter exists in
60
/// server::http::HttpRequest that is handled by the current task hierarchy.
61
/// @return `true` if the parameter exists, `false` otherwise
62
bool
HasTaskInheritedQueryParameter
(std::string_view name);
63
64
}
// namespace server::request
65
66
USERVER_NAMESPACE_END
userver
server
request
task_inherited_request.hpp
Generated on Wed Dec 4 2024 18:46:36 for userver by
Doxygen
1.10.0