RequestVals.host
Loading

RequestVals.host

Extract the hostname part of the Host request header and expose it as a String extraction to its inner route.

Example

final RequestVal<String> host = RequestVals.host();

final Route route = handleWith1(host,
    (ctx, hn) -> ctx.complete("Hostname: " + hn));

testRoute(route).run(HttpRequest.GET("/").addHeader(Host.create("company.com", 9090)))
    .assertEntity("Hostname: company.com");

Contents