diff --git a/src/branch-manager/branchManager.ts b/src/branch-manager/branchManager.ts index 000bd42..9ad2634 100644 --- a/src/branch-manager/branchManager.ts +++ b/src/branch-manager/branchManager.ts @@ -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}`); @@ -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; }