I\'m using an interceptor, and I would like to log the body of a request I\'m making but I can\'t see any way of doing this.
Is it possible ?
public
I tried to comment on the correct answer from @msung, but my reputation isn't high enough.
Here's modification I did to print RequestBody before making it a full request. It works like a charm. Thanks
private static String bodyToString(final RequestBody request){
try {
final RequestBody copy = request;
final Buffer buffer = new Buffer();
copy.writeTo(buffer);
return buffer.readUtf8();
}
catch (final IOException e) {
return "did not work";
}
}