Skip to content

Commit 18c00d0

Browse files
sobrinhotrusche
authored andcommitted
Use shortcut for blocks
1 parent 78cab07 commit 18c00d0

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/httplog/adapters/httpclient.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def do_get_block(req, proxy, conn, &block)
1919
request_uri = req.header.request_uri
2020
if HttpLog.url_approved?(request_uri)
2121
res = conn.pop
22-
headers = res.headers.transform_keys { |key| key.downcase }
22+
headers = res.headers.transform_keys(&:downcase)
2323

2424
HttpLog.call(
2525
method: req.header.request_method,

lib/httplog/adapters/patron.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def request(action_name, url, headers, options = {})
1010
end
1111

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

1515
HttpLog.call(
1616
method: action_name,

spec/support/test_server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def call(env)
2929
headers['Content-Type'] = 'application/json' if path =~ /json/
3030
headers['Content-Encoding'] = 'gzip' if File.extname(file) == '.gz'
3131

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

3434
[200, headers, File.binread(file)]
3535
else

0 commit comments

Comments
 (0)