#include <middleware.hpp>
Public Types | |
using | next_func_t = std::function< matador::http::response()> |
Public Member Functions | |
virtual | ~middleware ()=default |
virtual matador::http::response | process (matador::http::request &req, const next_func_t &next)=0 |
The middleware class is used when processing a HTTP request and works like onion layers around a request.
The interface consists only of one method process. Taking the incoming request and the next middleware callback object and returning the resulting response object.
With these incoming parameters the implementation has the ability to process the request before the next middleware has processed it and process the request after the next middleware has processed the request.
The same applies for the response object.
using matador::http::middleware::next_func_t = std::function<matador::http::response()> |
Shortcut to the next middleware callback
|
virtualdefault |
Destructor
|
pure virtual |
This method must implement the processing of the incoming request, call the next middleware processing and return a response object.
req | Incoming request to process |
next | Callback to the succeeding middleware |