我收到Log猫中Okhttp Logging拦截器的响应。但是,我无法从通话后的改装回应中得到它。 这是帖子的呼叫:
Retrofit Post请求无法从服务器获得响应Android
private void update(PostEntity postEntity){
Call<ResponseEntity> call = baseProvider.getApiClient().
createNewQuestion(mPrefs.getLoggedUserCityId(), postEntity);
call.enqueue(new Callback<ResponseEntity>() {
@Override
public void onResponse(Call<ResponseEntity> call, Response<ResponseEntity> response) {
Log.i("post:", response.body().toString());
}
@Override
public void onFailure(Call<ResponseEntity> call, Throwable t) {
Log.i("Not Working", "Retrofit is not updating the feed!!");
}
});
}
d/OkHttp:OkHttp - 发送 - 米利斯:1471598299803
d/OkHttp:OkHttp-收到-米利斯:1471598300522
d/OkHttp:{ “消息”: “成功发布”,“uuid”:“5dgiriWE4s4Sqhts”}
这里我得到了response.body()。toString是可以的。我无法获得okhttp拦截器输出,以便从服务器存储uuid。
它是要失败的方法 – Soham
@Soham不,它是一个成功的调用,它只进入onResponse。但是响应没有任何东西,Okhttp拦截器显示在logcat中。 –
ResponseEntity是什么? – Soham