matador::http::middleware Class Referenceabstract

#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
 

Detailed Description

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.

Member Typedef Documentation

◆ next_func_t

Shortcut to the next middleware callback

Constructor & Destructor Documentation

◆ ~middleware()

virtual matador::http::middleware::~middleware ( )
virtualdefault

Destructor

Member Function Documentation

◆ process()

virtual matador::http::response matador::http::middleware::process ( matador::http::request req,
const next_func_t next 
)
pure virtual

This method must implement the processing of the incoming request, call the next middleware processing and return a response object.

Parameters
reqIncoming request to process
nextCallback to the succeeding middleware
Returns
The response

The documentation for this class was generated from the following file:
  • matador/http/middleware.hpp