Skip to content

Commit

Permalink
fix: Do not rewind if the request body position did not change
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcastil committed Nov 13, 2024
1 parent c645fb1 commit 2d885c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/wafris/wafris_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ def initialize(request, env)
@request_id = env.fetch("action_dispatch.request_id", SecureRandom.uuid.to_s)
@request_timestamp = Time.now.utc.to_i

pos = request.body.pos
@body = encode_to_utf8(request.body&.read)
request.body&.rewind
request.body&.rewind if request.body.pos != pos
end

def data(treatment:, category:, rule:)
Expand Down

0 comments on commit 2d885c7

Please sign in to comment.