Skip to content

Commit

Permalink
Fix paging infinite loop (#12)
Browse files Browse the repository at this point in the history
Previously would BranchManager would correctly parse the link header but
fail to update the request options object, resulting in an infinite loop
when a next link is present.
  • Loading branch information
Michael Wu authored Jul 11, 2017
1 parent 4f45be2 commit 47d98f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/branch-manager/branchManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class BranchManager {
if (protectedBranchesOnly) {
uri = uri.concat("?protected=true");
}
const requestOptions = this.getDefaultRequestOptions(uri);
let requestOptions = this.getDefaultRequestOptions(uri);
let branches: IBranch[] = [];
do {
this.logger.debug(`GET ${uri}`);
Expand All @@ -171,6 +171,9 @@ export class BranchManager {
}
this.logger.debug(`Got link header: ${maybeLinkHeader}`);
uri = this.getNextLink(maybeLinkHeader as string);
if (uri !== undefined) {
requestOptions = this.getDefaultRequestOptions(uri);
}
} catch (error) {
throw error;
}
Expand Down

0 comments on commit 47d98f7

Please sign in to comment.