title: Appending headers to Rspec controller tests
body: <p>I'm trying to write out tests for a controller of mine that takes in requests from external services. So far this is my test:</p>
  
  <pre><code>describe ApplyController do
    context 'when valid' do
      let(:parameters) do
        file = File.join File.dirname(__FILE__), '..', 'samples', 'Indeed.json'
        JSON.parse(File.read file)
      end
      let(:signature) { 'GC02UVj0d4bqa5peNFHdPQAZ2BI=' }
  
      subject(:response) { post :indeed, parameters, 'X-Indeed-Signature' =&gt; signature }
  
      it 'returns 200 ok if Request is valid' do
        expect(response.status).to eq 200
      end
    end
  end
  </code></pre>
  
  <p>This should work according to the <a href="https://www.relishapp.com/rspec/rspec-rails/v/3-0/docs/controller-specs/cookies" rel="noreferrer">documentation</a> I could <a href="http://guides.rubyonrails.org/testing.html#setting-headers-and-cgi-variables" rel="noreferrer">find</a>.</p>
  
  <p>My controller right now looks something like this:</p>
  
  <pre><code>class ApplyController &lt; Application Controller
    def indeed
      binding.pry
    end
  end
  </code></pre>
  
  <p>When I get into Pry in my test and try to check the value of <code>request.headers['X-Indeed-Signature']</code> I always just get <code>nil</code></p>
  
  <p>Is there something that I am missing? I am using Rails 3.2 and Rspec 3</p>