I'm trying to make a rest call using Feign in a spring boot application and getting below stacktrace.

java.io.IOException: too many bytes written
at sun.net.www.protocol.http.HttpURLConnection$Stream ingOutputStream.write(HttpURLConnection.java:3574) ~[na:1.8.0_202]
at sun.net.www.protocol.http.HttpURLConnection$Stream ingOutputStream.write(HttpURLConnection.java:3565) ~[na:1.8.0_202]
at feign.Client$Default.convertAndSend(Client.java:21 4) ~[feign-core-11.8.jar:na]
at feign.Client$Default.execute(Client.java:104) ~[feign-core-11.8.jar:na]
at feign.SynchronousMethodHandler.executeAndDecode(Sy nchronousMethodHandler.java:119) ~[feign-core-11.8.jar:na]
at feign.SynchronousMethodHandler.invoke(SynchronousM ethodHandler.java:89) ~[feign-core-11.8.jar:na]
at feign.ReflectiveFeign$FeignInvocationHandler.invok e(ReflectiveFeign.java:100) ~[feign-core-11.8.jar:na]

In some of the blogs I saw that they have removed Content-Length header to avoid this exception. But in my case if I remove that, it's not taking my request body completely and hence input is not getting passed and that time I'm getting 400 Bad Request error.

Please advise on how to avoid this too many bytes written exception.