method

parse_formatted_parameters

Importance_0
v4.2.7 - Show latest stable - 0 notes - Class: ActionDispatch::ParamsParser
parse_formatted_parameters(env) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_dispatch/middleware/params_parser.rb, line 31
      def parse_formatted_parameters(env)
        request = Request.new(env)

        return false if request.content_length.zero?

        strategy = @parsers[request.content_mime_type]

        return false unless strategy

        case strategy
        when Proc
          strategy.call(request.raw_post)
        when :json
          data = ActiveSupport::JSON.decode(request.raw_post)
          data = {:_json => data} unless data.is_a?(Hash)
          Request::Utils.deep_munge(data).with_indifferent_access
        else
          false
        end
      rescue => e # JSON or Ruby code block errors
        logger(env).debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}"

        raise ParseError.new(e.message, e)
      end
Register or log in to add new notes.