Although there have been multiple issues over the years, trying to address this issue, the actual problem is still not solved and even for the cases it is, many might not find the output valuable in the way it is done.

Specifically, the issue of printing binary response body data either not at all or in a way that doesn't potentially mess up the users' terminal or is otherwise useless is still not solved at all and hasn't been addressed so far.

For requests (MockHttpServletRequest), preventing the output of binary data seems to work because: 1. the default value for field characterEncoding is null 2. the bean setter method id being called during tests by MockHttpServletRequestBuilder, which also means it actually can be influenced

For responses (MockHttpServletResponse), the same is impossible, because: 1. the field characterEncoding by default is ISO-8859-1 2. there seems to be no code that ever could set this field to null (only to other non-null values), except for the reset() method, which doesn't seem to be used

In addition, I personally have had many cases over the years where it would have been nice to see binary contents printed as standard base64, truncated to a configurable maximum length, so the console or CI logs don't get flooded.

This missing feature lead me to implement similar printf-code in tests over dozens of projects over and over again.

Comment From: bclozel

Printing binary data as base64 in tests didn't get much traction from the community. I haven't seen much issues related to this (besides #19342) so I'm not sure if there were other requests for this enhancement. I'm closing this issue for now.