Skip to content

Commit

Permalink
headers ending in "id" are displayed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
paa001 committed Feb 13, 2015
1 parent 93c88c5 commit 4b15530
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?

This comment has been minimized.

Copy link
@joshuaswilcox

joshuaswilcox Jun 18, 2015

This only fixes the display, but the curl.rb still has the same problem.

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 4b15530

Please sign in to comment.