fix: enable pagination for merge request search requests

pull/1010/head
Rhys Arkins 2017-10-20 14:18:19 +02:00
parent 612e3bb926
commit b92aa9ec4b
2 changed files with 11 additions and 5 deletions
lib/api
test/api/__snapshots__

View File

@ -191,8 +191,8 @@ async function getBranch(branchName) {
// Returns the Pull Request for a branch. Null if not exists.
async function getBranchPr(branchName) {
logger.debug(`getBranchPr(${branchName})`);
const urlString = `projects/${config.repoName}/merge_requests?state=opened`;
const res = await get(urlString);
const urlString = `projects/${config.repoName}/merge_requests?state=opened&per_page=100`;
const res = await get(urlString, { paginate: true });
logger.debug(`Got res with ${res.body.length} results`);
let pr = null;
res.body.forEach(result => {
@ -351,7 +351,7 @@ async function ensureCommentRemoval() {
async function findPr(branchName, prTitle, state = 'all') {
logger.debug(`findPr(${branchName}, ${prTitle}, ${state})`);
const urlString = `projects/${config.repoName}/merge_requests?state=${state}&per_page=100`;
const res = await get(urlString);
const res = await get(urlString, { paginated: true });
let pr = null;
res.body.forEach(result => {
if (

View File

@ -217,7 +217,10 @@ Array [
"user",
],
Array [
"projects/some%2Frepo/merge_requests?state=opened",
"projects/some%2Frepo/merge_requests?state=opened&per_page=100",
Object {
"paginate": true,
},
],
]
`;
@ -234,7 +237,10 @@ Array [
"user",
],
Array [
"projects/some%2Frepo/merge_requests?state=opened",
"projects/some%2Frepo/merge_requests?state=opened&per_page=100",
Object {
"paginate": true,
},
],
Array [
"projects/some%2Frepo/merge_requests/undefined",