I am developing android application where volley library working fine on some devices whereas on other device it is returing 406 exception for same request.
Postman also returning proper result with same request.
public void doPostOperation()
{
IOUtils.startLoadingPleaseWait(mContext);
JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, requestUrl, jsonRequest, listenerSuccess, listenerError)
{
@Override
public Map<String, String> getHeaders() throws AuthFailureError
{
Map<String, String> headers = new HashMap<String, String>();
headers.put("Cookie", Preference.getInstance(mContext).getData(Constants.Cookie));
headers.put("X-CSRF-Token", Preference.getInstance(mContext).getData(Constants.Token));
return headers;
}
};
request.setRetryPolicy(new DefaultRetryPolicy(60 * 1000, 1, 1.0f));
app.addToRequestQueue(request, "post");
}
Request -
{"password":"Distributor2","username":"Distributor2"}