diff --git a/src/main/java/org/kohsuke/github/Requester.java b/src/main/java/org/kohsuke/github/Requester.java index c9835677ea..af4819c3a1 100644 --- a/src/main/java/org/kohsuke/github/Requester.java +++ b/src/main/java/org/kohsuke/github/Requester.java @@ -264,10 +264,9 @@ private T _to(String tailApiUrl, Class 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 { @@ -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());