userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
client_with_middlewares.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/clients/http/client_with_middlewares.hpp
4
/// @brief @copybrief clients::http::ClientWithMiddlewares
5
6
#
ifdef
USERVER_TVM2_HTTP_CLIENT
7
#
error
Use
clients
::
Http
from
clients
/
http
.
hpp
instead
8
#
endif
9
10
#
include
<
userver
/
clients
/
http
/
client
.
hpp
>
11
#
include
<
userver
/
clients
/
http
/
middlewares
/
base
.
hpp
>
12
#
include
<
userver
/
utils
/
flags
.
hpp
>
13
#
include
<
userver
/
utils
/
impl
/
internal_tag_fwd
.
hpp
>
14
#
include
<
userver
/
utils
/
impl
/
wait_token_storage
.
hpp
>
15
16
USERVER_NAMESPACE_BEGIN
17
18
namespace
clients::http {
19
20
class
ClientCore;
21
22
/// @brief Security options for requests created by ClientWithMiddlewares.
23
enum
class
ClientOptions
{
24
kNone = 0,
25
kAllowUserInfo = 1 << 0,
26
};
27
28
/// @ingroup userver_clients
29
///
30
/// @brief HTTP client that returns an HTTP request builder from
31
/// CreateRequest() with applied middlewares.
32
///
33
/// Usually retrieved from @ref components::HttpClient component.
34
/// Can also be created in tests using @ref utest::CreateHttpClientWithMiddleware.
35
class
ClientWithMiddlewares
final
:
public
Client {
36
public
:
37
/// @cond
38
// For internal use only
39
ClientWithMiddlewares(
40
utils
::impl::InternalTag,
41
std::shared_ptr<ClientCore> client_core,
42
std::vector<
utils
::
NotNull
<clients::http::
MiddlewareBase
*>> middlewares,
43
utils
::Flags<
ClientOptions
> options = {}
44
);
45
/// @endcond
46
47
~ClientWithMiddlewares()
override
;
48
49
/// @brief Returns an HTTP request builder type with preset values of
50
/// User-Agent, middlewares and some of the Testsuite stuff (if any).
51
///
52
/// @note This method is thread-safe despite being non-const.
53
Request
CreateRequest
()
override
;
54
55
/// @cond
56
// For internal use only.
57
std::size_t GetActiveRequestCountDebug()
const
;
58
/// @endcond
59
60
private
:
61
std::shared_ptr<ClientCore> client_core_;
62
std::vector<
utils
::
NotNull
<clients::http::
MiddlewareBase
*>> middlewares_;
63
const
utils
::Flags<
ClientOptions
> options_;
64
utils
::impl::WaitTokenStorage wts_;
65
};
66
67
}
// namespace clients::http
68
69
USERVER_NAMESPACE_END
userver
clients
http
client_with_middlewares.hpp
Generated on
for userver by
Doxygen
1.17.0