Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore case sensitivity when filtering headers #274

Merged
merged 1 commit into from
Jun 23, 2016
Merged
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 @@ -76,7 +76,7 @@ def format_full_header(header, value)
def filter_headers(headers)
if !@config_headers_to_filer.empty?
headers.reject do |header|
@config_headers_to_filer.include?(format_header(header))
@config_headers_to_filer.map(&:downcase).include?(format_header(header).downcase)
end
else
headers
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec_api_documentation/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def remap_headers(requests, key, headers_to_include)
requests.each.with_index do |request_hash, index|
next unless request_hash.key?(key)
headers = request_hash[key]
request_hash[key] = headers.select{ |key, _| headers_to_include.include?(key) }
request_hash[key] = headers.select{ |key, _| headers_to_include.map(&:downcase).include?(key.downcase) }
requests[index] = request_hash
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
},
{
:request_headers => {
"Included" => "data",
"included" => "data",
"Other" => "not seen"
},
:request_method => "GET"
Expand All @@ -211,7 +211,7 @@
},
{
:request_headers => {
"Included" => "data",
"included" => "data",
},
:request_method => "GET"
}
Expand All @@ -232,7 +232,7 @@
},
{
:response_headers => {
"Included" => "data",
"included" => "data",
"Other" => "not seen"
},
:request_method => "GET"
Expand All @@ -250,7 +250,7 @@
},
{
:response_headers => {
"Included" => "data",
"included" => "data",
},
:request_method => "GET"
}
Expand Down