-1
我向服务器发出了一个查询,但出现错误。请告诉我,如何查看我的查询内容以查看错误在哪里。如何登录翻新2?如何查看POST查询中的内容?改造2
我向服务器发出了一个查询,但出现错误。请告诉我,如何查看我的查询内容以查看错误在哪里。如何登录翻新2?如何查看POST查询中的内容?改造2
您可以通过使用拦截器改造的HttpClient例如记录所有的请求,你可以在OkHttp添加HttpInterceptor依赖度以下的gradle中文件的步骤:
compile 'com.squareup.okhttp3:logging-interceptor:3.4.0'
然后
OKHttp client = ....
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
client.interceptors().add(interceptor);
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("url")
.client(client) // add custom OkHttp client
你不能从客户端查看您的查询异常。查看你的服务器日志 –
https://stackoverflow.com/questions/32514410/logging-with-retrofit-2 –