Module: Datadog::AppSec::Contrib::Rails::Request
- Defined in:
- lib/datadog/appsec/contrib/rails/request.rb
Overview
Normalized extration of data from ActionDispatch::Request
Class Method Summary collapse
Class Method Details
.parsed_body(request) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/datadog/appsec/contrib/rails/request.rb', line 9 def self.parsed_body(request) # force body parameter parsing, which is done lazily by Rails request.parameters # usually Hash<String,String> but can be a more complex # Hash<String,String||Array||Hash> when e.g coming from JSON or # with Rails advanced param square bracket parsing body = request.env['action_dispatch.request.request_parameters'] return if body.nil? body.reject do |k, _v| request.env['action_dispatch.request.path_parameters'].key?(k) end end |
.route_params(request) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/datadog/appsec/contrib/rails/request.rb', line 25 def self.route_params(request) excluded = [:controller, :action] request.env['action_dispatch.request.path_parameters'].reject do |k, _v| excluded.include?(k) end end |