title: Android Volley Post Request Header not changing
body: <p>I am using <code>Android Volley</code> library to send <code>POST</code> request. And for <code>POST</code> request</p>
  
  <ul>
  <li>Header is <code>Content-Type:application/json</code></li>
  <li>Post Body is  <code>Json String</code></li>
  </ul>
  
  <p>But whatever,I do to change the <code>Volley Request  Header</code> ,it is always set to <code>Content-Type:text/html</code>. And this gives me <code>400 Bad Request</code>. Here is my class for do <code>POST</code> request on <code>Volley</code></p>
  
  <pre><code>public class GsonRequest&lt;T&gt; extends Request&lt;T&gt; {
  private final Class&lt;T&gt; clazz;
  private final Map&lt;String, String&gt; headers;
  private final Listener&lt;T&gt; listener;
  private Map&lt;String, String&gt; postParams;
  private String postString = null;
  
  /**
   * Make a GET request and return a parsed object from JSON.
   * 
   * @param url
   *            URL of the request to make
   * @param clazz
   *            Relevant class object, for Gson's reflection
   * @param headers
   *            Map of request headers
   */
  public GsonRequest(int method, String url, Class&lt;T&gt; clazz,
          Map&lt;String, String&gt; headers, Map&lt;String, Object&gt; params,
          Listener&lt;T&gt; listener, ErrorListener errorListener) {
      super(method, url, errorListener);
  
      this.clazz = clazz;
      this.headers = headers;
      this.listener = listener;
  
      if (method == Method.POST &amp;&amp; params != null &amp;&amp; params.size() &gt; 0) {
          setRetryPolicy(new DefaultRetryPolicy(12000, 0,
                  DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
          postString = new GsonBuilder().create().toJson(params);
      }
  
  }
  
  @Override
  public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
      return headers != null ? headers : super.getHeaders();
  
  }
  
  @Override
  public byte[] getBody() throws AuthFailureError {
  
      return postString != null ? postString.getBytes(Charset
              .forName("UTF-8")) : super.getBody();
  }
  
  @Override
  public String getBodyContentType() {
      return postString !=null?"application/json; charset=utf-8":super.getBodyContentType();
  }
  
  @Override
  protected void deliverResponse(T response) {
      listener.onResponse(response);
  }
  
  @Override
  protected Response&lt;T&gt; parseNetworkResponse(NetworkResponse response) {
      try {
          String json = new String(response.data,
                  HttpHeaderParser.parseCharset(response.headers));
          Log.i("response", json);
  
          T responses = new GsonBuilder().create().fromJson(json, clazz);
          return Response.success(responses,
                  HttpHeaderParser.parseCacheHeaders(response));
      } catch (UnsupportedEncodingException e) {
          return Response.error(new ParseError(e));
      } catch (JsonSyntaxException e) {
          return Response.error(new ParseError(e));
      } catch (Exception e) {
          return Response.error(new ParseError(e));
  
      }
  }
  }
  </code></pre>
  
  <p>Any idea what I am doing wrong.I have tested with normal <code>HttpPost</code> and it is working from there, but while using <code>Volley</code>,my <code>POST Header</code> is never changed. </p>