Skip to content
Snippets Groups Projects
Unverified Commit a0bb61e9 authored by Michael Kriese's avatar Michael Kriese Committed by GitHub
Browse files

fix(bitbucket): use next url instead of custom paging (#34602)

parent 9dd1bdd1
No related branches found
Tags 19.15.5
No related merge requests found
...@@ -31,7 +31,10 @@ export class BitbucketHttp extends HttpBase<BitbucketHttpOptions> { ...@@ -31,7 +31,10 @@ export class BitbucketHttp extends HttpBase<BitbucketHttpOptions> {
options: InternalJsonUnsafeOptions<BitbucketHttpOptions>, options: InternalJsonUnsafeOptions<BitbucketHttpOptions>,
): Promise<HttpResponse<T>> { ): Promise<HttpResponse<T>> {
const resolvedUrl = this.resolveUrl(options.url, options.httpOptions); const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);
const opts = { ...options, url: resolvedUrl }; const opts: InternalJsonUnsafeOptions<BitbucketHttpOptions> = {
...options,
url: resolvedUrl,
};
const paginate = opts.httpOptions?.paginate; const paginate = opts.httpOptions?.paginate;
if (paginate && !hasPagelen(resolvedUrl)) { if (paginate && !hasPagelen(resolvedUrl)) {
...@@ -47,10 +50,10 @@ export class BitbucketHttp extends HttpBase<BitbucketHttpOptions> { ...@@ -47,10 +50,10 @@ export class BitbucketHttp extends HttpBase<BitbucketHttpOptions> {
if (paginate && isPagedResult(result.body)) { if (paginate && isPagedResult(result.body)) {
const resultBody = result.body; const resultBody = result.body;
let nextURL = result.body.next; let nextURL = result.body.next;
let page = 2; let page = 1;
for (; nextURL && page <= MAX_PAGES; page++) { for (; nextURL && page <= MAX_PAGES; page++) {
resolvedUrl.searchParams.set('page', page.toString()); opts.url = nextURL;
const nextResult = await super.requestJsonUnsafe<PagedResult<T>>( const nextResult = await super.requestJsonUnsafe<PagedResult<T>>(
method, method,
opts, opts,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment