Reputation: 47871
I tried following instructions on how to pass the custom headers but it's not working for me. Here's what I'm calling in my respec test
post :create, {name:profile.name}, {'X-API-KEY' => 'somekey'}
From my controller I don't see it in the header as X-API-KEY but instead seems to be in request.headers["rack.session"]["X-API-KEY"]
How do I get it to not pass it as "rack.session"
Upvotes: 5
Views: 2154
Reputation: 679
I've been digging through the issue this morning as well. The problem comes from here http://apidock.com/rails/ActionController/TestProcess/process as the method signature looks like this (action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
. This was quite unexpected to me and I'll keep looking though I'm not quite sure why it happens like this.
To get it working you could do
before do
request.headers['X-API-KEY'] = 'somekey'
end
This works, although not exactly what I wanted/expected from the get
method.
Upvotes: 6