httpx/tests
Varun Chawla a5e4db62be
Fix confusing error message for invalid data parameter
When AsyncClient receives invalid data like data=[{"a": "b"}] (list of dicts),
it was raising "Attempted to send a sync request with an AsyncClient instance"
which is misleading. The actual issue is invalid data format.

This fix adds early validation in encode_request() to check if data is a
list/tuple containing non-bytes objects, and raises a clear TypeError with
helpful guidance (use json= or data={...} instead).

Fixes #3471
2026-03-10 06:08:21 -07:00
..
client Upgrade Python type checker mypy (#3654) 2025-09-04 08:48:49 -05:00
fixtures Add NetRCAuth() class. (#2535) 2023-01-12 11:27:46 +00:00
models Adapt test_response_decode_text_using_autodetect for chardet 6.0 (#3773) 2026-02-23 10:40:42 +00:00
__init__.py Drop RedirectLoop exception (#819) 2020-02-24 10:09:52 +00:00
common.py Use relative tests directory references (#1052) 2020-07-16 16:28:31 +02:00
concurrency.py use # pragma: no cover instead of # pragma: nocover (#2471) 2022-11-29 10:23:18 -06:00
conftest.py Introduce new SSLContext API & escalate deprecations. (#3319) 2024-10-28 14:30:08 +00:00
test_api.py made dependencies on certifi and httpcore only load when required (#3377) 2024-10-29 13:18:39 +00:00
test_asgi.py Introduce new SSLContext API & escalate deprecations. (#3319) 2024-10-28 14:30:08 +00:00
test_auth.py format (#3131) 2024-03-01 19:49:23 +00:00
test_config.py Graceful upgrade path for 0.28. (#3394) 2024-11-12 11:31:42 +00:00
test_content.py Fix confusing error message for invalid data parameter 2026-03-10 06:08:21 -07:00
test_decoders.py Handle empty zstd responses (#3412) 2024-11-22 11:42:51 +00:00
test_exceptions.py Use __future__.annotations (#3068) 2024-01-24 14:30:22 +00:00
test_exported_members.py Drop private imports from test_exported_members.py (#2573) 2023-02-09 16:00:27 +00:00
test_main.py Ensure JSON representation is compact. #3363 (#3367) 2024-10-28 14:40:22 +00:00
test_multipart.py format (#3131) 2024-03-01 19:49:23 +00:00
test_status_codes.py Typing: enable strict_equality (#2480) 2022-12-02 08:45:28 +00:00
test_timeouts.py Fix client.send() timeout new Request instance (#3116) 2024-02-26 16:36:58 +00:00
test_utils.py Move utility functions from _utils.py to _client.py (#3389) 2024-11-15 11:42:52 +00:00
test_wsgi.py Introduce new SSLContext API & escalate deprecations. (#3319) 2024-10-28 14:30:08 +00:00