title: Volley Server Error with null Network response
body: <p>Every time I try to use POST method with Volley, I get sever error. I get null value in getCause, and some default value in getNetworkResponse.toString().</p>
  
  <p>If I use GET method, this works fine (I get response from my url).</p>
  
  <p>Can anybody help what can I do?</p>
  
  <pre><code>    Map&lt;String, String&gt; jsonParams = new HashMap&lt;String, String&gt;();
      jsonParams.put("teststr", "abd");
  
      RequestQueue requestQueue = VolleySingleton.getInstance().getRequestQueue();
      JsonObjectRequest request = new JsonObjectRequest(
              Request.Method.POST,
              url,
              new JSONObject(jsonParams),
              new Response.Listener&lt;JSONObject&gt;() {
                  @Override
                  public void onResponse(JSONObject response) {
  
                      try {
                          Toast.makeText(getApplicationContext(), "Success"+response.toString(), Toast.LENGTH_LONG).show();
                      }catch(Exception e){
                          Toast.makeText(getApplicationContext(), "JSON ERROR", Toast.LENGTH_LONG).show();
                      }
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      Log.d("abd", "Error: " + error
                                      + "&gt;&gt;" + error.networkResponse.statusCode
                                      + "&gt;&gt;" + error.networkResponse.data
                                      + "&gt;&gt;" + error.getCause()
                                      + "&gt;&gt;" + error.getMessage());
                  }
              }) {
  
                  @Override
                  protected Map&lt;String,String&gt; getParams() {
                      HashMap&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                      params.put("key", "value");
                      return params;
                  }
  
                  @Override
                  public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
                      HashMap&lt;String, String&gt; headers = new HashMap&lt;String, String&gt;();
                      headers.put("Content-Type", "application/json; charset=utf-8");
                      return headers;
                  }
      };
      requestQueue.add(request);
  </code></pre>
  
  <p>Error Log:</p>
  
  <blockquote>
    <p>Error:
    Error: com.android.volley.ServerError>>404>>[B@42b1e0d0>>null>>null</p>
  </blockquote>
  
  <p><strong>UPDATE:</strong>
  <strong>networkResponse.statusCode comes as 404, though the url is accessible (and return data if I just use GET method). If I remove header part in POST method, still the same.</strong></p>
  
  <p><strong>the url:</strong></p>
  
  <pre><code>&lt;?php
      $response = array();
  
      $jsonString = file_get_contents('php://input');
      $jsonObj = json_decode($jsonString, true);
  
      if(!isset($jsonObj['teststr'])){
          $response["msg"] = "No data.";
      }else{
          $response["msg"] = "Success: ".$jsonObj['teststr'];
      }
      echo json_encode($response);
  ?&gt;
  </code></pre>