userver: userver/clients/http/component.hpp Source File
Loading...
Searching...
No Matches
component.hpp
Go to the documentation of this file.
1#pragma once
2
3#ifdef USERVER_TVM2_HTTP_CLIENT
4#error Use components::Http from clients/http.hpp instead
5#endif
6
9
10#include <memory>
11
15
16USERVER_NAMESPACE_BEGIN
17
18namespace components {
19
47class HttpClient : public ComponentBase {
48public:
51 static constexpr std::string_view kName = "http-client";
52
55 static constexpr std::string_view kDynamicConfigClientName = "dynamic-config-http-client";
56
57 HttpClient(const ComponentConfig&, const ComponentContext&);
58
59 clients::http::Client& GetHttpClient();
60
62
63protected:
65 HttpClient(const ComponentConfig&, const ComponentContext&, std::unique_ptr<clients::http::Client>);
66
67private:
68 std::unique_ptr<clients::http::Client> http_client_;
69};
70
71template <>
72inline constexpr bool kHasValidate<HttpClient> = true;
73
74template <>
76
77} // namespace components
78
79USERVER_NAMESPACE_END