title: How to Set the Content Type in a ActionController::TestCase request
body: <p>I was trying to perform a get in my TestCase like this:</p>
  
  <pre><code>request.env['CONTENT_TYPE'] = 'application/json'
  get :index,:application_name=&gt;"Heka"
  </code></pre>
  
  <p>Though, it fails with a:</p>
  
  <pre><code>ActionView::MissingTemplate: Missing template alarm_events/index with {:handlers=&gt;[:builder, :haml, :erb, :rjs, :rhtml, :rxml], :locale=&gt;[:en, :en], :formats=&gt;[:html]
  </code></pre>
  
  <p>Despite that in my controller I have:</p>
  
  <pre><code>respond_to :html, :json
  
  def index
      @alarm_events=[...]
  
      respond_with @alarm_events do |format|
        format.json{
          render :json=&gt;@alarm_events.map{|e| e.to_portal_representation}.to_json, 
                 :content_type=&gt;'application/json'
        }
      end
    end
  </code></pre>
  
  <p>How the hell should I code the intended request on the TestCase? </p>
  
  <p><strong>When I request alarm_events.json in the browser it works fine.</strong></p>
  
  <p>Thanks</p>