userver: userver/server/request/task_inherited_request.hpp Source File
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
10USERVER_NAMESPACE_BEGIN
11
12namespace http::headers {
13class PredefinedHeader;
14}
15
16namespace server::request {
17
18/// @brief Get a header from server::http::HttpRequest that is handled by the
19/// current task hierarchy.
20/// @return Header value or an empty string, if none such
21const std::string& GetTaskInheritedHeader(std::string_view header_name);
22
23/// @overload
24const std::string& GetTaskInheritedHeader(
25 const USERVER_NAMESPACE::http::headers::PredefinedHeader& header_name);
26
27/// @brief Checks whether specified header exists in server::http::HttpRequest
28/// that is handled by the current task hierarchy.
29/// @return `true` if the header exists, `false` otherwise
30bool HasTaskInheritedHeader(std::string_view header_name);
31
32/// @overload
34 const USERVER_NAMESPACE::http::headers::PredefinedHeader& header_name);
35
36} // namespace server::request
37
38USERVER_NAMESPACE_END