title: Volley BasicNetwork.performRequest: Unexpected response code 400
body: <p>I am creating an android project. For my project I created a REST API using the PHP Slim Framework. When I am opening the URL of the API in my browser it is working fine. See the image below. </p>
  
  <p><a href="https://i.stack.imgur.com/MqzHt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MqzHt.png" alt="enter image description here"></a></p>
  
  <p>But when I am trying to send a request to this URL (shown in the snapshot above) using JsonObjectRequest, I am getting this error in my logcat. </p>
  
  <p>E/Volley: [397] BasicNetwork.performRequest: Unexpected response code 400 for <a href="http://192.168.94.1/MyApplication/v1/countrydata" rel="nofollow noreferrer">http://192.168.94.1/MyApplication/v1/countrydata</a></p>
  
  <p>I am using the following code. </p>
  
  <pre><code>JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, Config.URL_COUNTRY_DATA, new Response.Listener&lt;JSONObject&gt;() {
          @Override
          public void onResponse(JSONObject response) {
              Toast.makeText(getApplicationContext(),response.toString(),Toast.LENGTH_SHORT).show();
          }
      }, new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
              Toast.makeText(getApplicationContext(),error.getMessage(),Toast.LENGTH_SHORT).show();
          }
      }){
          @Override
          protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
              Map&lt;String,String&gt; params = new HashMap&lt;String,String&gt;();
              params.put("Authorization",Config.API_KEY);
              return params;
          }
  
          @Override
          public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
              Map&lt;String,String&gt; headers = new HashMap&lt;String,String&gt;();
              headers.put("Charset", "UTF-8");
              headers.put("Content-Type", "application/x-javascript");
              return headers;
          }
      };
      AppController.getInstance().addToRequestQueue(jsonObjectRequest);
  </code></pre>
  
  <p>I searched a lot on google and found some cconfusing solutions. Some are saying that you are not using header, some said don't user header etc etc.</p>
  
  <p>I tried all the solutions but none of them worked so far. </p>