Skip to content

Commit

Permalink
Fix request logger for large requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
arscan committed Feb 2, 2024
1 parent b3ddbfc commit 7d15bd9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/inferno/utils/middleware/request_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ def log_request(env)
path = env['REQUEST_URI']
query = env['rack.request.query_string']
body = env['rack.input']
body = body.instance_of?(Puma::NullIO) ? nil : body.string
body =
if body.instance_of? Puma::NullIO
nil
else
contents = body.read
body.rewind
contents
end
query_string = query.blank? ? '' : "?#{query}"

logger.info("#{method} #{scheme}://#{host}#{path}#{query_string}")
Expand Down

0 comments on commit 7d15bd9

Please sign in to comment.