Skip to content

Commit

Permalink
fix issue introduced with 3.14.4 where binary data is not read
Browse files Browse the repository at this point in the history
  • Loading branch information
ryber committed Jul 7, 2023
1 parent b8ab11e commit 7bcb8e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ void getGetResultAsBytes() {
cap.assertStatus(200);
}

@Test
void getGetBinaryResultAsBytes() {
byte[] content = Unirest.get(MockServer.BINARYFILE)
.asBytes()
.getBody();

assertEquals(46246, content.length);
}

@Test
void getGetResultAsBytesAsync() throws Exception {
byte[] content = Unirest.get(MockServer.GET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public InputStream getContent() {

@Override
public byte[] getContentAsBytes() {
if (!hasContent() || ContentType.isBinary(getContentType())) {
if (!hasContent()) {
return new byte[0];
}
try {
Expand Down

0 comments on commit 7bcb8e0

Please sign in to comment.