Skip to content

Commit

Permalink
Use shortcut for blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
sobrinho authored and trusche committed Feb 25, 2024
1 parent 78cab07 commit 18c00d0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/httplog/adapters/httpclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def do_get_block(req, proxy, conn, &block)
request_uri = req.header.request_uri
if HttpLog.url_approved?(request_uri)
res = conn.pop
headers = res.headers.transform_keys { |key| key.downcase }
headers = res.headers.transform_keys(&:downcase)

HttpLog.call(
method: req.header.request_method,
Expand Down
2 changes: 1 addition & 1 deletion lib/httplog/adapters/patron.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def request(action_name, url, headers, options = {})
end

if HttpLog.url_approved?(url)
normalized_headers = @response.headers.transform_keys { |key| key.downcase }
normalized_headers = @response.headers.transform_keys(&:downcase)

HttpLog.call(
method: action_name,
Expand Down
2 changes: 1 addition & 1 deletion spec/support/test_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def call(env)
headers['Content-Type'] = 'application/json' if path =~ /json/
headers['Content-Encoding'] = 'gzip' if File.extname(file) == '.gz'

headers.transform_keys! { |key| key.downcase } if params['downcase']
headers = headers.transform_keys(&:downcase) if params['downcase']

[200, headers, File.binread(file)]
else
Expand Down

0 comments on commit 18c00d0

Please sign in to comment.