Typedef morpheus::request_handler_fn_t
Defined in File http_server.hpp
-
using morpheus::request_handler_fn_t = std::function<parse_status_t(const tcp_endpoint_t &tcp_endpoint, const request_t &request)>
A function that receives the TCP endpoint, and the request object. Returning an instance of
parse_status_t
.The function is expected to return a tuple conforming to
parse_status_t
consisting of the HTTP status code, mime type value for the Content-Type header, body of the response and optionally a callback function. If specified, the callback function which will be called once the response has been sent or failed to send, as indicated by aboost::system::error_code
reference passed to the function.Refer to https://www.boost.org/doc/libs/1_74_0/libs/system/doc/html/system.html#ref_class_error_code for more information regarding
boost::system::error_code
.Note: This method is preferred over the payload_parse_fn_t as it provides access to the request headers.