Logging with Retrofit 2

前端 未结 21 1594
春和景丽
春和景丽 2020-11-22 07:33

I\'m trying to get the exact JSON that is being sent in the request. Here is my code:

OkHttpClient client = new OkHt         


        
21条回答
  •  独厮守ぢ
    2020-11-22 08:19

    Try this:

    Request request = chain.request();
    Buffer buffer = new Buffer();
    request.body().writeTo(buffer);
    String body = buffer.readUtf8();
    

    After this, in the body there is the JSON you are interested in.

提交回复
热议问题