userver: userver/testsuite/middlewares.hpp Source File
Loading...
Searching...
No Matches
middlewares.hpp
1#pragma once
2
3#include <userver/server/middlewares/http_middleware_base.hpp>
4
5USERVER_NAMESPACE_BEGIN
6
7namespace testsuite {
8
9class ExceptionsHandlingMiddleware final : public server::middlewares::HttpMiddlewareBase {
10public:
11 static constexpr std::string_view kName{"testsuite-exceptions-handling-middleware"};
12
13 explicit ExceptionsHandlingMiddleware(const server::handlers::HttpHandlerBase& handler);
14
15private:
16 void HandleRequest(server::http::HttpRequest& request, server::request::RequestContext& context) const override;
17
18 const server::handlers::HttpHandlerBase& handler_;
19};
20
21using ExceptionsHandlingMiddlewareFactory =
22 server::middlewares::SimpleHttpMiddlewareFactory<ExceptionsHandlingMiddleware>;
23
24} // namespace testsuite
25
26USERVER_NAMESPACE_END