Skip to content

Commit

Permalink
added a method to return the raw unprocessed body
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Mar 22, 2015
1 parent 709e47f commit 5a8845f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main/java/org/kohsuke/github/Requester.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.InterruptedIOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Array;
Expand All @@ -55,8 +54,6 @@
import com.fasterxml.jackson.databind.JsonMappingException;
import org.apache.commons.io.IOUtils;

import javax.net.ssl.HttpsURLConnection;

/**
* A builder pattern for making HTTP call and parsing its output.
*
Expand Down Expand Up @@ -247,6 +244,20 @@ public int asHttpStatusCode(String tailApiUrl) throws IOException {
}
}

public InputStream read(String tailApiUrl) throws IOException {
while (true) {// loop while API rate limit is hit
HttpURLConnection uc = setupConnection(root.getApiURL(tailApiUrl));

buildRequest(uc);

try {
return uc.getInputStream();
} catch (IOException e) {
handleApiError(e,uc);
}
}
}

private void buildRequest(HttpURLConnection uc) throws IOException {
if (!method.equals("GET")) {
uc.setDoOutput(true);
Expand Down

0 comments on commit 5a8845f

Please sign in to comment.