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 {
34public:
35 InspectRequests(const components::ComponentConfig& config, const components::ComponentContext& component_context);
36
37 /// @ingroup userver_component_names
38 /// @brief The default name of server::handlers::InspectRequests
39 static constexpr std::string_view kName = "handler-inspect-requests";
40
41 formats::json::Value HandleRequestJsonThrow(
42 const http::HttpRequest& request,
43 const formats::json::Value& request_json,
44 request::RequestContext& context
45 ) const override;
46
47 static yaml_config::Schema GetStaticConfigSchema();
48
49private:
50 RequestsView& view_;
51};
52
53} // namespace handlers
54} // namespace server
55
56template <>
57constexpr inline bool components::kHasValidate<server::handlers::InspectRequests> = true;
58
59USERVER_NAMESPACE_END