Skip to content

Commit

Permalink
fix(HTTP Request Node): Resolve max pages expression (#10192)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsmr authored Jul 25, 2024
1 parent 7775d50 commit bfc8e1b
Show file tree
Hide file tree
Showing 2 changed files with 215 additions and 106 deletions.
25 changes: 20 additions & 5 deletions packages/core/src/NodeExecuteFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3168,10 +3168,16 @@ const getRequestHelperFunctions = (
additionalKeys.$response = newResponse;
additionalKeys.$pageCount = additionalKeys.$pageCount + 1;

if (
paginationOptions.maxRequests &&
additionalKeys.$pageCount >= paginationOptions.maxRequests
) {
const maxRequests = getResolvedValue(
paginationOptions.maxRequests,
itemIndex,
runIndex,
executeData,
additionalKeys,
false,
) as number;

if (maxRequests && additionalKeys.$pageCount >= maxRequests) {
break;
}

Expand All @@ -3186,7 +3192,16 @@ const getRequestHelperFunctions = (

if (makeAdditionalRequest) {
if (paginationOptions.requestInterval) {
await sleep(paginationOptions.requestInterval);
const requestInterval = getResolvedValue(
paginationOptions.requestInterval,
itemIndex,
runIndex,
executeData,
additionalKeys,
false,
) as number;

await sleep(requestInterval);
}
if (tempResponseData.statusCode < 200 || tempResponseData.statusCode >= 300) {
// We have it configured to let all requests pass no matter the response code
Expand Down
Loading

0 comments on commit bfc8e1b

Please sign in to comment.