My Android JsonObjectRequest drive is starting on onErrorResponse with a problem:
BasicNetwork.performRequest: Unexpected response code 405 for MY_URL
My url is valid. I checked this with a browser and I get the expected JSON object. Therefore, the problem should be on the client side.
Code 405 means:
Method not allowed. The method specified in the query string is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource.
my code for JsonObjectRequest:
JsonObjectRequest jsonReq;
jsonReq = new JsonObjectRequest(URL_FEED, new JSONObject(),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
VolleyLog.v("Response:%n %s", response.toString(4));
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.v("ERROR:%n %s", error.getMessage());
}
});
NetworkController.getInstance().addToRequestQueue(jsonReq);
Do I need to add some information to the header? And if for information?
source
share