Skip to content

Commit

Permalink
Merge pull request #216 from if6was9/issue-215-download-failure
Browse files Browse the repository at this point in the history
#215 fix read() failure with private repos
  • Loading branch information
kohsuke committed Dec 1, 2015
2 parents c3b4ee9 + b0687db commit f9291f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/kohsuke/github/GHHooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ private Context(GitHub root) {
}

public List<GHHook> getHooks() throws IOException {
List<GHHook> list = new ArrayList<GHHook>(Arrays.asList(
root.retrieve().to(collection(), collectionClass())));

GHHook [] hookArray = root.retrieve().to(collection(),collectionClass()); // jdk/eclipse bug requires this to be on separate line
List<GHHook> list = new ArrayList<GHHook>(Arrays.asList(hookArray));
for (GHHook h : list)
wrap(h);
return list;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/kohsuke/github/Requester.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,12 @@ public InputStream asStream(String tailApiUrl) throws IOException {
while (true) {// loop while API rate limit is hit
setupConnection(root.getApiURL(tailApiUrl));

buildRequest();


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

buildRequest();

try {
return wrapStream(uc.getInputStream());
} catch (IOException e) {
Expand Down

0 comments on commit f9291f9

Please sign in to comment.