Skip to content

Commit

Permalink
Fixing issue raised in #247
Browse files Browse the repository at this point in the history
From Shredder121,
--------------------
Only the HttpURLConnection.method was set by that change. Not the
Requester.method.

This means that Requester.method is still set to POST, isMethodWithBody
will return true, and uc.setDoOutput(true) will be called.

I use Okhttp, and their HttpURLConnectionImpl's method changes to POST
if you tell it to open a stream to write to.
  • Loading branch information
kohsuke committed Mar 2, 2016
1 parent 54c3070 commit dbc79f8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main/java/org/kohsuke/github/Requester.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,9 @@ private <T> T _to(String tailApiUrl, Class<T> type, T instance) throws IOExcepti
*/
public int asHttpStatusCode(String tailApiUrl) throws IOException {
while (true) {// loop while API rate limit is hit
method("GET");
setupConnection(root.getApiURL(tailApiUrl));

uc.setRequestMethod("GET");

buildRequest();

try {
Expand All @@ -280,12 +279,10 @@ public int asHttpStatusCode(String tailApiUrl) throws IOException {

public InputStream asStream(String tailApiUrl) throws IOException {
while (true) {// loop while API rate limit is hit
method("GET"); // if the download link is encoded with a token on the query string, the default behavior of POST will fail
setupConnection(root.getApiURL(tailApiUrl));

// if the download link is encoded with a token on the query string, the default behavior of POST will fail
uc.setRequestMethod("GET");

buildRequest();
buildRequest();

try {
return wrapStream(uc.getInputStream());
Expand Down

0 comments on commit dbc79f8

Please sign in to comment.