Improve printing of empty, unrecognizable and non-raw bodies
akashivskyy opened this issue · comments
Currently ResponseDetective prints <none>
for bodies in the following situations:
- when the body is empty, i.e. has 0 bytes;
- and when the body cannot be deserialized, i.e. has an unsupported content-type.
The 2nd situation might be confusing as <none>
might suggest that a request has an empty body.
The proposal is to improve handling of empty and non-deserializable bodies in the following way:
- for empty bodies → print
<empty>
; - for non-deserializable bodies → print
<unrecognizable x bytes>
.
In addition, other non-raw bodies, such as 1px × 1px image
for image/*
content-type, should also be wrapped in triangular brackets (i.e. <1px × 1px image>
) so that it can be distinguished from plain text bodies with similar contents.