title: How to set request headers in rspec request spec?
body: <p>In the controller spec, I can set http accept header like this:</p>
  
  <pre><code>request.accept = "application/json"
  </code></pre>
  
  <p>but in the request spec, "request" object is nil. So how can I do it here?</p>
  
  <p>The reason I want to set http accept header to json is so I can do this:</p>
  
  <pre><code>get '/my/path'
  </code></pre>
  
  <p>instead of this</p>
  
  <pre><code>get '/my/path.json'
  </code></pre>