Volley, BasicNetwork.performRequest: Unexpected response code 405, while making StringRequest

10,772

The problem is that you are using a POST api request for a GET request. In your StringRequest Method use GET instead of POST.

StringRequest sr = new StringRequest(Request.Method.GET, String url, Listener<String> listener, ErrorListener errorListener);
Share:
10,772
sandeep gupta
Author by

sandeep gupta

android developer, J2EE, RUBY

Updated on September 11, 2022

Comments

  • sandeep gupta
    sandeep gupta over 1 year

    Using Volley, I POST StringRequest and i am getting error when i am accessing the url, as it is

    https://www.google.com/?gfe_rd=cr&ei=vX8jVdTvOsOq8weigYHICA&gws_rd=cr&fg=1
    

    But when is use http instead of https above, it won't give error and working well.

    cookie and client code is below,

     DefaultHttpClient client_R = new DefaultHttpClient();
        RequestQueue queue_R = Volley.newRequestQueue(this, new HttpClientStack(client_R));
            CookieStore store_R = client_R.getCookieStore();
            Cookie cookie_R = new BasicClientCookie("Example_Cookie", "80");
            store_R.addCookie(cookie_R);
    

    below is logcat output,

    [199] BasicNetwork.performRequest: Unexpected response code 405 for https://www.google.com/?gfe_rd=cr&ei=TX4jVcChFaTj8wehzoCgCw&gws_rd=cr&fg=1
    

    Why it is giving error ? With some URLs having https, it is working instead.