Method: Watchdocs::Rails::Helpers::BodyHelper#parse_request_body

Defined in:
lib/watchdocs/rails/helpers/body_helper.rb

#parse_request_body(body) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/watchdocs/rails/helpers/body_helper.rb', line 20

def parse_request_body(body)
  return if body.empty?
  filter_data(JSON.parse(body))
rescue JSON::ParserError
  begin
    filter_data(Rack::Utils.parse_nested_query(body))
  rescue StandardError
    log_and_return_empty "Request body format not supported. Body: #{body}"
  end
end