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

Add support for accessing request headers #1

Closed lantunes closed 10 years ago

lantunes commented 11 years ago

It should be possible to access request headers in the response body, using '$' as the delimeter. For example:

server.handle(Method.GET, "/")
      .with(200, "text/plain", "User Agent: [request$User-Agent]");

Response resp = new AsyncHttpClient()
                .prepareGet("http://localhost:8080/")
                .execute()
                .get();

assertEquals("User Agent: NING/1.0", resp.getResponseBody().trim());