改造响应显示

时间:2018-09-20 12:18:05

标签: android

我尝试使用改造方法将原始数据发布到服务器,但是我收到诸如res失败之类的失败响应:Response {protocol = http / 1.1,code = 500,message = Internal Server Error,url = http://192.168.1.9:8000/api/deviceinfo }

apiService = RetrofitSingleton.createService(ApiService.class);
spyApp = new SpyApp();
Call<ModelResponse> call  = apiService.eventsUpdate(jsonObj);
call.enqueue(new Callback<ModelResponse>() {
    @Override
    public void onResponse(Call<ModelResponse> call, Response<ModelResponse> response) {
        Log.e("response", new Gson().toJson(response.body())); //This shows null
        if (response.isSuccessful()) {
            String status = response.body().getData().getStatus();
                           } else {
            Log.e("res fail", response.toString());
        }
    }

    @Override
    public void onFailure(Call<ModelResponse> call, Throwable t) {
        Log.e("failure",t.getMessage());
    }
});

0 个答案:

没有答案