/** * Verifies HTTP response body content against provided matcher, * and throws {@link AssertionError} in case of mismatch. * @param matcher The matcher to use * @return This object */ public RestResponse assertBinary(final Matcher<byte[]> matcher) { MatcherAssert.assertThat( String.format( "HTTP response binary content is not valid:%n%s", this ), this.binary(), matcher ); return this; }
@Override public InputStream raw() throws IOException { return new ByteArrayInputStream( this.request.reset(HttpHeaders.ACCEPT) .header( HttpHeaders.ACCEPT, "application/vnd.github.v3.raw" ).fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK).binary() ); } }
/** * Get raw release asset content. * * @see <a href="http://developer.github.com/v3/repos/releases/">Releases API</a> * @return Stream with content * @throws IOException If some problem inside. */ @Override public InputStream raw() throws IOException { return new ByteArrayInputStream( this.request.method(Request.GET) .reset(HttpHeaders.ACCEPT).header( HttpHeaders.ACCEPT, "application/vnd.github.v3.raw" ) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .binary() ); }