Interface Interceptor

'Intercepror' intercepts Request. It can modify request, or log it, or cache it or do whatever you need. When done it can return response or pass it to next request handler.

interface Interceptor ;

Methods

NameDescription
opCall

Example

class ChangePath : Interceptor
{
   Response opCall(Request r, RequestHandler next)
      {
          r.path = r.path ~ "get";
          auto rs = next.handle(r);
          return rs;
      }
}

Later in the code you can use this class:

Example

Request rq;
rq.addInterceptor(new ChangePath());
rq.get("http://example.com");