Consume the http response to avoid IO exception

This commit is contained in:
Maxime Sinclair
2013-07-10 10:07:31 +02:00
parent a0c3fbe525
commit f34d9ca34e

View File

@@ -57,6 +57,10 @@ public class TestImage extends WebappTestCase {
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ZZZ", Locale.ENGLISH);
Date lastModified = format.parse( response.getHeaderField( "Last-Modified"));
assertTrue( "Last-Modified is not in the past", lastModified.before( new Date()));
Thread.sleep(500); // Time to receive the image
// Consume the response
InputStream responseStream = response.getInputStream();
while( responseStream.read() != -1) {
; // Do nothing
}
}
}