Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do round trip with json dumps and loads to ensure true json params #1780

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading