Skip to content

FIX Keep repeated query parameters in make_request_and_raise_if_error_async - #3511

Open
Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
microsoft:mainfrom
ShivamSharma43:fix/net-utility-repeated-query-params
Open

Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
microsoft:mainfrom
ShivamSharma43:fix/net-utility-repeated-query-params

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Description

Fixes #3510.

make_request_and_raise_if_error_async read the endpoint URL's query with extract_url_parameters, which flattens it to a dict[str, str] with the first value of each key. So ?tag=a&tag=b was sent as ?tag=a, with or without extra_url_parameters.

Changes:

  • The URL's query is parsed with parse_qsl(..., keep_blank_values=True) into (key, value) pairs and passed to httpx as a tuple of pairs, so every value is sent. Blank values are still kept (Preserve empty URL query parameters #1494).
  • A key in extra_url_parameters still takes precedence: it replaces all of that key's values from the URL, and the other keys are appended as before.

URLs without repeated keys are sent the same way as before. extract_url_parameters itself is unchanged.

Tests and Documentation

  • New parametrized test in tests/unit/common/test_common_net_utility.py: repeated keys with no extra parameters, with an extra parameter added, with an extra parameter replacing another key, and with an extra parameter replacing a repeated key. It checks the URL that is actually sent.
  • On main the first three cases fail (only tag=a is sent); the fourth passes on both and pins that an extra parameter replaces every URL value of its key.
  • pytest tests/unit/common plus the callers' tests (test_figstep_dataset.py, test_image_cache.py, test_msts_dataset.py, test_azure_ml_chat_target.py, test_hack_a_prompt_target.py, test_prompt_shield_target.py): 786 passed.
  • ruff check, ruff format and ty check pass on the changed files.
  • No documentation changes.

🤖 Generated with Claude Code

…_async

The endpoint URL's query was flattened to a dict with one value per
key, so "?tag=a&tag=b" was sent as "?tag=a". Parse the query into
(key, value) pairs instead, so every value is sent, and let a key in
extra_url_parameters replace all of that key's URL values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 24, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Keeping query parameters as pairs preserves repeated values, and explicit extra parameters still replace all URL values for the same key.

Reviewed with GitHub Copilot.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: make_request_and_raise_if_error_async drops repeated query parameters from the endpoint URL

3 participants