我目前有一个问题,我无法查看改造请求的完整响应,只有一切似乎。Android Retrofit 2得到全身响应
我ApiManager:
public class ApiManager {
public interface AmbiApi {
@POST("users/register")
Call<User> registerUser(@Body User user);
}
private static final String API_URL = "http://api.staging.ambiapp.com/v1/";
private static final Retrofit RETROFIT = new Retrofit.Builder()
.baseUrl(API_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
private static final AmbiApi AMBI_API = RETROFIT.create(AmbiApi.class);
public static AmbiApi getApi() {
return AMBI_API;
}
使得API调用:
Call<User> registerUserCall = ApiManager.getApi().registerUser(user);
registerUserCall.enqueue(registerCallback);
回调:
@Override
public void onResponse(Response<User> response, Retrofit retrofit) {
Log.e("LOG", "Retrofit Response: " + response.raw().toString());
}
@Override
public void onFailure(Throwable t) {
//
}
现在,当前呼叫只输出:
Retrofit Response: Response{protocol=http/1.1, code=500, message=Internal Server Error, url=http://api.staging.ambiapp.com/v1/users/register}
这是因为我知道什么是错误的,但无论错误是否包含在响应中,我只是无法确定如何看到内部服务器错误是什么。
任何帮助,将不胜感激
我不能包括在我的项目?当试图向我的依赖 –
添加'compile'com.squareup.okhttp:logging-interceptor:2.5.0''时,只是在解决错误时才解决错误,它仅在2.6.0-SNAPSHOT版本中可用 –