My Android Volley JsonObjectRequest runs into onErrorResponse with the issue:
BasicNetwork.performRequest: Unexpected response code 405 for MY_URL
My URL is valid. I have checked that with a browser and I get there the expected JSON Object. So the issue has to be on the client side.
The code 405 means:
Method Not Allowed The method specified in the Request-Line 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());
}
});
// Adding request to volley request queue
NetworkController.getInstance().addToRequestQueue(jsonReq);
Do I have to add some information to the header? And if what for information?