netguru / ResponseDetective

Sherlock Holmes of the networking layer. :male_detective:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve printing of empty, unrecognizable and non-raw bodies

akashivskyy opened this issue · comments

Currently ResponseDetective prints <none> for bodies in the following situations:

  1. when the body is empty, i.e. has 0 bytes;
  2. 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:

  1. for empty bodies → print <empty>;
  2. 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.