Looked around but couldn't find solution to this. Checking status code via following code:
JsonObjectRequest req = new JsonObjectRequest(URL, null,
response -> {
Log.d("Response", response.toString(4));
},error -> {
NetworkResponse networkResponse = error.networkResponse;
if (networkResponse != null) {
if (error.networkResponse.statusCode == 204) {
Toast.makeText(Customers.this, "No Content!",Toast.LENGTH_LONG).show();
//This is where I want request to return when no content.
}
}else{
//Null Network Response, request returns in this section
}
}
When I send 204 Status code from server, which is for NO_CONTENT, request returns in error section and with network response NULL so I can't check if it was NO_CONTENT error or internet issue or some other.
Let me know if anyone can help. Thanks
There was issue with server side logic. It worked after fixing that. Thanks everyone.