Skip to content

Commit

Permalink
Merge pull request #20 from Tomasfire/bugfix/paginator-single-result-fix
Browse files Browse the repository at this point in the history
ServiceNow: Bugfix - Paginator single result fix
  • Loading branch information
phantom-jacob authored Jan 2, 2025
2 parents a8ce21d + 99f48e5 commit 6741f22
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions servicenow_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,11 +1044,12 @@ def _paginator(self, endpoint, action_result, payload=None, limit=None):

# get total record count from headers
if self._response_headers:
total_item_count = int(self._response_headers.get("X-Total-Count"))
total_item_count = int(self._response_headers.get("X-Total-Count", 1))

# if result is found
if items.get("result"):
items_list.extend(items.get("result"))
result = items.get("result")
if result:
items_list.extend(result if isinstance(result, list) else [result])

# extend item list if data is present on that page
if limit and len(items_list) >= limit:
Expand Down

0 comments on commit 6741f22

Please sign in to comment.