Commit 6d0045d2 authored by Mike Greiling's avatar Mike Greiling

fix rubocop violations

parent 0258a37f
# rubocop:disable Style/ClassVars
module Gitlab module Gitlab
module Testing module Testing
class RequestInspectorMiddleware class RequestInspectorMiddleware
...@@ -30,12 +32,13 @@ module Gitlab ...@@ -30,12 +32,13 @@ module Gitlab
request_headers = env_http_headers(env) request_headers = env_http_headers(env)
status, headers, body = @app.call(env) status, headers, body = @app.call(env)
log_response(OpenStruct.new( request = OpenStruct.new(
url: url, url: url,
status_code: status, status_code: status,
request_headers: request_headers, request_headers: request_headers,
response_headers: headers response_headers: headers
)) )
log_request request
[status, headers, body] [status, headers, body]
end end
...@@ -43,14 +46,14 @@ module Gitlab ...@@ -43,14 +46,14 @@ module Gitlab
private private
def env_http_headers(env) def env_http_headers(env)
Hash[*env.select {|k,v| k.start_with? 'HTTP_'} Hash[*env.select {|k, v| k.start_with? 'HTTP_'}
.collect {|k,v| [k.sub(/^HTTP_/, ''), v]} .collect {|k, v| [k.sub(/^HTTP_/, ''), v]}
.collect {|k,v| [k.split('_').collect(&:capitalize).join('-'), v]} .collect {|k, v| [k.split('_').collect(&:capitalize).join('-'), v]}
.sort .sort
.flatten] .flatten]
end end
def log_response(response) def log_request(response)
@@logged_requests.push(response) @@logged_requests.push(response)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment