/** * Verify the response content-type * * @param contentType * expected content-type without any charset extension, such as "text/html" * @param response * server response */ public static void assertContentType(String contentType, Response response) { String responseContentType = response.contentType; assertNotNull("Response contentType missing", responseContentType); assertTrue("Response contentType unmatched : '" + contentType + "' !~ '" + responseContentType + "'", responseContentType.startsWith(contentType)); }
/** * Exact equality assertion on a response header value * * @param headerName * header to verify. case-insensitive * @param value * expected header value * @param response * server response */ public static void assertHeaderEquals(String headerName, String value, Response response) { assertNotNull("Response header " + headerName + " missing", response.headers.get(headerName)); assertEquals("Response header " + headerName + " mismatch", value, response.headers.get(headerName).value()); }