test client crashes when posting bytes
b8a41a2872624a6d9e61308932dd81d001e31eb9 removes the force_bytes
method for encoding data in post requests with data.encode()
. This breaks the usecase of posting data=bytes
to TestClient.post()
, since that type does not have that function. The old implementation of course just returned the same value unchanged in case of a bytes value.
A simple fix would be to add an if not isinstance(bytes, data)
check before invoking the _encode_data
function.
Change History
(6)
Severity: |
Normal → Release blocker
|
Triage Stage: |
Unreviewed → Accepted
|
Has patch: |
set
|
Summary: |
Posting bytes broken in 2.1 TestClient → test client crashes when posting bytes
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
Simply reverting the commit (and adding a test with a
bytes
-POST data) could also be considered.