okhttp请求参数打印字符串RequestBody ,FormBody

Okhttp打印请求参数body,转换为字符串
RequestBody

 Buffer buffer=new Buffer();
        try {
            requestBody.writeTo(buffer);
            String requestBodyToString = buffer.readUtf8();
            Log.d("====请求参数=====",requestBodyToString );
        } catch (IOException e) {
            e.printStackTrace();
        }

FormBody

 Buffer buffer=new Buffer();
        try {
            formBody.writeTo(buffer);
            String formBodyToString = buffer.readUtf8();
            Log.d("====请求参数=====",formBodyToString );
        } catch (IOException e) {
            e.printStackTrace();
        }

你可能感兴趣的:(android,okhttp,android,java)