Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rspec_api_documentation/curl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def format_auth_header(value)
end

def format_header(header)
header.gsub(/^HTTP_/, '').titleize.split.join("-")
header.gsub(/^HTTP_/, '').split(/ |\_|\-/).map! { |part| part.tap(&:capitalize!) }.join('-')
end

def format_full_header(header, value)
Expand Down
2 changes: 2 additions & 0 deletions spec/curl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"HTTP_ACCEPT" => "application/json",
"HTTP_X_HEADER" => "header",
"HTTP_AUTHORIZATION" => %{Token token="mytoken"},
"HTTP_DEVICE-ID" => "header",
"HTTP_HOST" => "example.org",
"HTTP_COOKIES" => "",
"HTTP_SERVER" => nil
Expand All @@ -26,6 +27,7 @@
it { should =~ /-X POST/ }
it { should =~ /-H "Accept: application\/json"/ }
it { should =~ /-H "X-Header: header"/ }
it { should =~ /-H "Device-Id: header"/ }
it { should =~ /-H "Authorization: Token token=\\"mytoken\\""/ }
it { should =~ /-H "Server: "/ }
it { should_not =~ /-H "Host: example\.org"/ }
Expand Down