Good evening, you need to send a request to the server and put the following in the header.
Authorization: Bearer rsNQgkedqLca
where rsNQgkedqLca is a token.
How I try to solve this problem:
@GET("/get-free-request-count") Call<Count> getCount(@Header("Authorization") String token); Call<Count> call = (Call<Count>) mServerApi.getCount("Bearer " + mToken); call.enqueue(new Callback<Count>() { @Override public void onResponse(Call<Count> call, Response<Count> response) { if (response.body().getmCount().equals("2")) { Toast.makeText(getApplicationContext(), "У вас осталось: " + response.body().getmCount(), Toast.LENGTH_LONG);
What am I doing wrong?
java.lang.
response.body()
null
. Try to display the response (or its internal parts) as a line - maybe there is some useful info there - YuriySPb ♦