Search in sources :

Example 1 with HttpHeader

use of com.openmeap.http.HttpHeader in project OpenMEAP by OpenMEAP.

the class AdminTest method testLogin.

public void testLogin() throws Exception {
    HttpResponse response = helper.getLogin();
    Utils.consumeInputStream(response.getResponseBody());
    response = helper.postLogin(AdminTestHelper.ADMIN_USER, AdminTestHelper.ADMIN_PASS);
    Assert.assertTrue(response.getStatusCode() == 302);
    HttpHeader[] headers = response.getHeaders("Location");
    Assert.assertTrue(headers.length == 1);
    Assert.assertTrue(headers[0].getValue().equals(helper.getAdminUrl()));
    Utils.consumeInputStream(response.getResponseBody());
    // Tomcat will shoot you in the face if you don't follow it's redirects
    response = helper.getRequestExecuter().get(headers[0].getValue());
    Utils.consumeInputStream(response.getResponseBody());
}
Also used : HttpHeader(com.openmeap.http.HttpHeader) HttpResponse(com.openmeap.http.HttpResponse)

Aggregations

HttpHeader (com.openmeap.http.HttpHeader)1 HttpResponse (com.openmeap.http.HttpResponse)1