title: Using "Content-Type:application/json" to post in curl gives HTTP/1.1 400 BAD REQUEST
body: <p>When I make a post request using the following </p>
  
  <pre><code>curl -i -d "username=rock&amp;password=rock" http://my_VM_IP/api/1.1/json/my_login/
  </code></pre>
  
  <p>it generates the required response generating a token like this(abridged):</p>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Mon, 22 Oct 2012 08:37:39 GMT
  Vary: Authorization,Accept-Language,Cookie,Accept-Encoding
  Content-Type: text/plain
  Transfer-Encoding: chunked
  OK{"success": {"my_token": "required_token"}}
  </code></pre>
  
  <p>But when I try the same including a header as:</p>
  
  <pre><code>curl -i -H "Content-Type:application/json" -d "username=rock&amp;password=rock" http://my_VM_IP/api/1.1/json/my_login/ 
  </code></pre>
  
  <p>it gives me the following error:</p>
  
  <pre><code>HTTP/1.1 400 BAD REQUEST
  Date: Mon, 22 Oct 2012 11:12:04 GMT
  Vary: Authorization,Accept-Language,Cookie,Accept-Encoding
  ***Content-Type: text/plain***
  Content-Language: en-us
  Connection: close
  Transfer-Encoding: chunked
  Bad Request
  </code></pre>
  
  <p>I dont understand why this happens. And also <strong><em>why does the content-Type show text/plain</em></strong>, I also tried looking at some other questions like <a href="https://stackoverflow.com/questions/11724547/why-setting-post-content-typeapplication-json-causes-a-bad-request-on-rest?rq=1">Why Setting POST Content-type:&quot;Application/Json&quot; causes a &quot;Bad Request&quot; on REST WebService?</a> . It also addresses the same problem I have. Following the answer in that I tried giving the data in various formats as </p>
  
  <pre><code>{"username":"rock", "password":"rock"} 
  </code></pre>
  
  <p>but without success. Thanks in advance.</p>