By default the settings of the Http() extension running the route will be returned. It is possible to override the settings for specific sub-routes by using the withSettings directive.
sourceimport static akka.http.javadsl.server.Directives.extractRequestContext;finalRoute route = extractRequestContext(ctx ->{
ctx.getLog().debug("Using access to additional context available, like the logger.");finalHttpRequest request = ctx.getRequest();return complete("Request method is "+ request.method().name()+" and content-type is "+ request.entity().getContentType());});// tests:
testRoute(route).run(HttpRequest.POST("/").withEntity("text")).assertEntity("Request method is POST and content-type is text/plain; charset=UTF-8");
testRoute(route).run(HttpRequest.GET("/")).assertEntity("Request method is GET and content-type is none/none");