Skip to content

Commit

Permalink
Merge pull request #197 from paa001/master
Browse files Browse the repository at this point in the history
headers ending in "id" are displayed correctly
  • Loading branch information
oestrich committed Feb 13, 2015
2 parents 93c88c5 + 4b15530 commit 6617a33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/rspec_api_documentation/headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def env_to_headers(env)
# HTTP_ACCEPT_CHARSET => Accept-Charset
if key =~ /^(HTTP_|CONTENT_TYPE)/
header = key.gsub(/^HTTP_/, '').titleize.split.join("-")
header.concat('-Id') if key.scan(/_ID\Z/).any?
headers[header] = value
end
end
Expand Down
5 changes: 3 additions & 2 deletions spec/http_test_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@

describe "#request_headers" do
before do
test_client.get "/", {}, { "Accept" => "application/json", "Content-Type" => "application/json" }
test_client.get "/", {}, { "Accept" => "application/json", "Content-Type" => "application/json", "User-Id" => "1" }
end

it "should contain all the headers" do
expect(test_client.request_headers).to eq({
"Accept" => "application/json",
"Content-Type" => "application/json"
"Content-Type" => "application/json",
"User-Id" => "1"
})
end
end
Expand Down

0 comments on commit 6617a33

Please sign in to comment.