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 committed Dec 21, 2023
1 parent a01fc15 commit ba1e821
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 @@ -717,7 +717,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 @@ -766,7 +772,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 @@ -787,7 +793,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 ba1e821

Please sign in to comment.