Skip to content

Commit

Permalink
Improve code style in AppSec rack middlewares
Browse files Browse the repository at this point in the history
  • Loading branch information
y9v committed Jan 14, 2025
1 parent 3b2a59a commit b2604ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions lib/datadog/appsec/contrib/rack/request_body_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ def call(env)

http_response = nil
block_actions = catch(::Datadog::AppSec::Ext::INTERRUPT) do
http_response, = Instrumentation.gateway.push(
'rack.request.body', Gateway::Request.new(env)
) do
http_response, = Instrumentation.gateway.push('rack.request.body', Gateway::Request.new(env)) do
@app.call(env)
end

nil
end
http_response = AppSec::Response.negotiate(env, block_actions).to_rack if block_actions

return AppSec::Response.negotiate(env, block_actions).to_rack if block_actions

http_response
end
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/appsec/contrib/rack/request_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def call(env)
add_appsec_tags(processor, ctx)
add_request_tags(ctx, env)

gateway_request = Gateway::Request.new(env)
http_response = nil
gateway_request = Gateway::Request.new(env)
gateway_response = nil

block_actions = catch(::Datadog::AppSec::Ext::INTERRUPT) do
Expand Down

0 comments on commit b2604ff

Please sign in to comment.