Skip to content

Commit

Permalink
Do round trip with json dumps and loads to ensure true json params (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adehad authored Dec 21, 2023
1 parent 9206b3e commit 095565a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,13 @@ def _fetch_pages(
except ImportError:
pass
async_workers = self._options.get("async_workers")
page_params = params.copy() if params else {}

def json_params() -> dict[str, Any]:
# passing through json.dumps and json.loads ensures json
return json.loads(json.dumps(params.copy())) if params else {}

page_params = json_params()

if startAt:
page_params["startAt"] = startAt
if maxResults:
Expand Down Expand Up @@ -770,7 +776,7 @@ def _fetch_pages(
session=self._session, max_workers=async_workers
)
for start_index in range(page_start, total, page_size):
page_params = params.copy() if params else {}
page_params = json_params()
page_params["startAt"] = start_index
page_params["maxResults"] = page_size
url = self._get_url(request_path)
Expand All @@ -795,7 +801,7 @@ def _fetch_pages(
and len(next_items_page) == page_size
):
page_params = (
params.copy() if params else {}
json_params()
) # Hack necessary for mock-calls to not change
page_params["startAt"] = page_start
page_params["maxResults"] = page_size
Expand Down

0 comments on commit 095565a

Please sign in to comment.