Skip to content

Preserve empty URL query parameters#1494

Merged
hannahwestra25 merged 2 commits intomicrosoft:mainfrom
biefan:preserve-empty-url-query-parameters
Mar 24, 2026
Merged

Preserve empty URL query parameters#1494
hannahwestra25 merged 2 commits intomicrosoft:mainfrom
biefan:preserve-empty-url-query-parameters

Conversation

@biefan
Copy link
Copy Markdown
Contributor

@biefan biefan commented Mar 17, 2026

Summary

  • preserve explicitly empty query parameter values when extracting URL params
  • keep empty query parameters intact when make_request_and_raise_if_error_async() rebuilds request URLs
  • add regression coverage for blank query values in both helper and request paths

Problem

extract_url_parameters() currently uses parse_qs() with its default behavior, which drops query parameters whose value is explicitly empty.

For example:

  • https://api.example.com/endpoint?api-version=&mode=test
  • http://testserver/api/test?alpha=&beta=1

currently lose the empty parameter before the request is rebuilt.

That means explicitly provided empty query parameters are silently removed from outgoing requests, which can change endpoint behavior for APIs that distinguish flag= from an absent parameter.

Testing

  • .venv/bin/pytest tests/unit/common/test_common_net_utility.py -q

@hannahwestra25 hannahwestra25 merged commit 33f5dd4 into microsoft:main Mar 24, 2026
1 check passed
jbolor21 pushed a commit to jbolor21/jbolor-PyRIT that referenced this pull request Mar 25, 2026
Co-authored-by: Roman Lutz <romanlutz13@gmail.com>
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.

4 participants