title: Overriding the default Content-Type
body: <p>I have a Rails API which accepts only JSON as input.  If I fail to include a header of Content-Type: application/json, then <code>request.headers['Content-Type']</code> defaults to <code>application/x-www-form-urlencoded</code> and the params do not get parsed properly.  The whole json body becomes a key in the params.  The result is a 422, which is confusing to API users.</p>
  
  <p><strong>How can I change this to default to parsing as json if no Content-Type header is supplied?</strong></p>
  
  <p>Lots of other questions answer how to do this with the response format.  To change this default, you can specify it in the controller with:</p>
  
  <pre><code> request.format = :json
  </code></pre>
  
  <p>Or in a route namespace with something like:</p>
  
  <pre><code> namespace :api, defaults: {format: :json} do
  </code></pre>
  
  <p>This, however, changes the default response format and does not change the default request format.  <strong>What I need to do is to change the default request format for parsing parameters.</strong></p>