lantunes / fixd

An HTTP Server Fixture for Testing HTTP Clients and mocking web services, and a Java Micro Web Framework
http://bigtesting.org/fixd
Apache License 2.0
41 stars 6 forks source link

Provide a mechanism for filtering requests before and after #9

Open lantunes opened 10 years ago

lantunes commented 10 years ago

The server should provide a mechanism for performing actions before and after a particular kind of request. Below is a rough example:

server.before(Method.GET, "/protected/*")
    .with(new HttpRequestHandler() {
         public void handle(HttpRequest request, HttpResponse response) {                    
             logger.log("a request was made to " + request.getPath());
            }
    });

A corresponding method would exist for after().