public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
request.response().end();
}
});
final YokeTester yokeAssert = new YokeTester(yoke);
// first time is forbidden
yokeAssert.request("GET", "/", new Handler<Response>() {
@Override
public void handle(Response resp) {
assertEquals(401, resp.getStatusCode());
assertNotNull(resp.headers.get("www-authenticate"));
// second time send the authorization header
MultiMap headers = new CaseInsensitiveMultiMap();
headers.add("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
yokeAssert.request("GET", "/", headers, new Handler<Response>() {
@Override
public void handle(Response resp) {
assertEquals(200, resp.getStatusCode());
testComplete();
}