Skip to content

Commit

Permalink
Test binary to byte fetch OK
Browse files Browse the repository at this point in the history
  • Loading branch information
jhy committed May 12, 2019
1 parent 247c5d0 commit b87c013
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/java/org/jsoup/integration/ConnectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit b87c013

Please sign in to comment.