Skip to content

fix(httpclient): URL-encode dict data without files#94

Merged
Oaklight merged 1 commit into
masterfrom
fix/httpclient-dict-data
Jun 1, 2026
Merged

fix(httpclient): URL-encode dict data without files#94
Oaklight merged 1 commit into
masterfrom
fix/httpclient-dict-data

Conversation

@Oaklight
Copy link
Copy Markdown
Owner

@Oaklight Oaklight commented Jun 1, 2026

Summary

  • _prepare_body(data={"key": "value"}) silently returned (None, None) when files was not provided — the dict fell through all branches
  • Added a dict branch that URL-encodes the data as application/x-www-form-urlencoded, matching httpx/requests behavior
  • urlencode was already imported, so no new imports needed

Closes #93

Test plan

  • Unit tests added in TestPrepareBody (6 cases: basic dict, special chars, empty dict, json priority, str data, None data)
  • All existing edge tests still pass
  • Pre-commit hooks pass (ruff, ruff-format, ty, complexipy)

_prepare_body(data={"key": "value"}) silently returned (None, None)
when files was not provided. Add a dict branch that URL-encodes the
data as application/x-www-form-urlencoded, matching httpx/requests
behavior.

Closes #93
@Oaklight Oaklight merged commit 8dc6f6b into master Jun 1, 2026
6 checks passed
@Oaklight Oaklight deleted the fix/httpclient-dict-data branch June 1, 2026 19:30
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.

httpclient: _prepare_body silently drops dict data without files

1 participant