userver: userver/server/handlers/inspect_requests.hpp Source File
Loading...
Searching...
No Matches
inspect_requests.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/server/handlers/inspect_requests.hpp
4/// @brief @copybrief server::handlers::InspectRequests
5
6#include <userver/server/handlers/http_handler_json_base.hpp>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace server {
11
12class RequestsView;
13
14namespace handlers {
15// clang-format off
16
17/// @ingroup userver_components userver_http_handlers
18///
19/// @brief Handler that returns information about all in-flight requests.
20///
21/// The component has no service configuration except the
22/// @ref userver_http_handlers "common handler options".
23///
24/// ## Static configuration example:
25///
26/// @snippet components/common_server_component_list_test.cpp Sample handler inspect requests component config
27///
28/// ## Scheme
29/// Provide an optional query parameter `body` to get the bodies of all the
30/// in-flight requests.
31
32// clang-format on
33class InspectRequests final : public HttpHandlerJsonBase {
34 public:
35 InspectRequests(const components::ComponentConfig& config,
36 const components::ComponentContext& component_context);
37
38 /// @ingroup userver_component_names
39 /// @brief The default name of server::handlers::InspectRequests
40 static constexpr std::string_view kName = "handler-inspect-requests";
41
42 formats::json::Value HandleRequestJsonThrow(
43 const http::HttpRequest& request,
44 const formats::json::Value& request_json,
45 request::RequestContext& context) const override;
46
47 static yaml_config::Schema GetStaticConfigSchema();
48
49 private:
50 RequestsView& view_;
51};
52
53} // namespace handlers
54} // namespace server
55
56template <>
57constexpr inline bool
58 components::kHasValidate<server::handlers::InspectRequests> = true;
59
60USERVER_NAMESPACE_END