Volley API Error Response in Android APP

Hello,
I am trying to read Json response on specific HTTP status code using volley error method. Yet I am unable to read JSON response following this way it gives me HTML code while returning the response.

//Doing this by Using VolleyError class.
String responseBody = new String(error.networkResponse.data, “utf-8”);
// Log.i(“DataX:”, responseBody);
// JSONObject data = new JSONObject(responseBody);
// Log.i(“Data:”, error.networkResponse.data.toString());

If anyone can provide any help with this.

This may be related.

If your ERPNext server is not upgraded to include the code in PR, then use “Accept” header like mentioned in PR and try

@revant_one Thank you so much for your input on this. Yes, It was because of the headers. I am able to fetch the JSON with other status code as well.