Handler that returns HTTP 200 if the service is OK and able to process requests.
More...
#include <userver/server/handlers/ping.hpp>
|
| Ping (const components::ComponentConfig &config, const components::ComponentContext &component_context) |
|
std::string | HandleRequestThrow (const http::HttpRequest &request, request::RequestContext &context) const override |
|
Public Member Functions inherited from server::handlers::HttpHandlerBase |
| HttpHandlerBase (const components::ComponentConfig &config, const components::ComponentContext &component_context, bool is_monitor=false) |
|
void | HandleRequest (request::RequestBase &request, request::RequestContext &context) const override |
|
void | ReportMalformedRequest (request::RequestBase &request) const final |
|
virtual const std::string & | HandlerName () const |
|
const std::vector< http::HttpMethod > & | GetAllowedMethods () const |
|
virtual logging::Level | GetLogLevelForResponseStatus (http::HttpStatus status) const |
|
virtual FormattedErrorData | GetFormattedExternalErrorBody (const CustomHandlerException &exc) const |
|
std::string | GetResponseDataForLoggingChecked (const http::HttpRequest &request, request::RequestContext &context, const std::string &response_data) const |
|
Public Member Functions inherited from server::handlers::HandlerBase |
| HandlerBase (const components::ComponentConfig &config, const components::ComponentContext &component_context, bool is_monitor=false) |
|
virtual void | HandleRequest (request::RequestBase &request, request::RequestContext &context) const =0 |
|
virtual void | ReportMalformedRequest (request::RequestBase &) const |
|
bool | IsMonitor () const |
| Returns whether this is a monitoring handler.
|
|
const HandlerConfig & | GetConfig () const |
| Returns handler config.
|
|
| LoggableComponentBase (const ComponentConfig &, const ComponentContext &) |
|
| LoggableComponentBase (LoggableComponentBase &&)=delete |
|
| LoggableComponentBase (const LoggableComponentBase &)=delete |
|
| ~LoggableComponentBase () override=default |
|
ComponentHealth | GetComponentHealth () const override |
|
void | OnLoadingCancelled () override |
|
void | OnAllComponentsLoaded () override |
|
void | OnAllComponentsAreStopping () override |
|
|
static constexpr std::string_view | kName = "handler-ping" |
|
Handler that returns HTTP 200 if the service is OK and able to process requests.
Uses components::ComponentContext::IsAnyComponentInFatalState() to detect fatal state (can not process requests).
The component has no service configuration except the common handler options.
- Examples
- samples/production_service/production_service.cpp.
Definition at line 22 of file ping.hpp.
◆ HandleRequestThrow()
The core method for HTTP request handling. request
arg contains HTTP headers, full body, etc. The method should return response body.
- Note
- It is used only if IsStreamed() returned
false
.
Reimplemented from server::handlers::HttpHandlerBase.
◆ kName
constexpr std::string_view server::handlers::Ping::kName = "handler-ping" |
|
staticconstexpr |
The documentation for this class was generated from the following file: