diff --git a/src/test/java/org/jsoup/integration/ConnectTest.java b/src/test/java/org/jsoup/integration/ConnectTest.java index 386ff43b38..f2bb871986 100644 --- a/src/test/java/org/jsoup/integration/ConnectTest.java +++ b/src/test/java/org/jsoup/integration/ConnectTest.java @@ -539,4 +539,16 @@ public void testBinaryContentTypeThrowsException() { } assertTrue(threw); } + + @Test + public void canFetchBinaryAsBytes() throws IOException { + Connection.Response res = Jsoup.connect(FileServlet.Url) + .data(FileServlet.LocationParam, "/htmltests/thumb.jpg") + .data(FileServlet.ContentTypeParam, "image/jpeg") + .ignoreContentType(true) + .execute(); + + byte[] bytes = res.bodyAsBytes(); + assertEquals(1052, bytes.length); + } }