AhcCurlRequestLogger throw exception that kill request

Is the right decision to throw Exception from AhcCurlRequestLogger? I guess this filter helps you to logging request. But I was very surprised when it crashes my response with uploaded file.

AhcCurlRequestLogger throw new UnsupportedOperationException("Unsupported body type " + requestBody.getClass()) and this exception not catch in filter. And the design of this filter doesn’t give you an instrument for preventing that. I can’t override or wrapping it. I can’t catch it in my code. Does anybody know, It is normal behavior

Hey @theSemenov,

So, by default, the request bodies are mapped in three distinct ways:

  1. Empty
  2. In memory
  3. Stream (Source)

For empty and in memory, it is possible to generate the curl command, but the same does not applies to Source: maybe it was generated from a File, maybe an InputStream, or maybe from a Source[ByteString], and, therefore, there is not way to translate that to curl. That is why the filter fails.

Since the filter is added per request and not globally, the recommendation is to not add it when using such Source bodies.