8#include <userver/components/loggable_component_base.hpp>
9#include <userver/yaml_config/schema.hpp>
10#include <userver/yaml_config/yaml_config.hpp>
12USERVER_NAMESPACE_BEGIN
28namespace middlewares {
36 virtual ~HttpMiddlewareBase();
41 request::RequestContext& context)
const = 0;
44 void Next(http::HttpRequest& request,
request::RequestContext& context)
const;
49 std::unique_ptr<HttpMiddlewareBase> next_{
nullptr};
57 HttpMiddlewareFactoryBase(
const components::ComponentConfig&,
60 std::unique_ptr<HttpMiddlewareBase> CreateChecked(
61 const handlers::HttpHandlerBase& handler,
62 yaml_config::YamlConfig middleware_config)
const;
80template <
typename Middleware>
83 static constexpr std::string_view kName = Middleware::kName;
88 std::unique_ptr<HttpMiddlewareBase> Create(
89 const handlers::HttpHandlerBase& handler,
90 yaml_config::YamlConfig)
const override {
91 return std::make_unique<Middleware>(handler);
98template <
typename Middleware>
100 server::middlewares::SimpleHttpMiddlewareFactory<Middleware>> =
true;
102template <
typename Middleware>
103inline constexpr auto components::kConfigFileMode<
104 server::middlewares::SimpleHttpMiddlewareFactory<Middleware>> =