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
10 : public server::middlewares::HttpMiddlewareBase {
11 public:
12 static constexpr std::string_view kName{
13 "testsuite-exceptions-handling-middleware"};
14
15 explicit ExceptionsHandlingMiddleware(
16 const server::handlers::HttpHandlerBase& handler);
17
18 private:
19 void HandleRequest(server::http::HttpRequest& request,
20 server::request::RequestContext& context) const override;
21
22 const server::handlers::HttpHandlerBase& handler_;
23};
24
25using ExceptionsHandlingMiddlewareFactory =
26 server::middlewares::SimpleHttpMiddlewareFactory<
27 ExceptionsHandlingMiddleware>;
28
29} // namespace testsuite
30
31USERVER_NAMESPACE_END