Skip to content

Conversation

@amritamishra01
Copy link

Fixes #6557

Summary
Previously, passing an empty list as a query parameter value (e.g., params={'key': []}) caused the key to be silently dropped from the URL. This behavior was inconsistent with empty strings (params={'key': ''}), which correctly produce ?key=.

Changes

  • Modified parameter encoding logic in models.py to treat empty lists as a list containing a single empty string [''].
  • Verified that ?key= is generated, matching the behavior of empty strings.

Tests

  • Added regression test test_params_with_empty_list_are_included in tests/test_requests.py.
  • Verified locally with pytest.

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.

URL parameter is added when the value is an empty string but not when it is an empty list

1 participant