123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Request::Utils

Do not use. This class is for internal use only.
Relationships & Source Files
Namespace Children
Classes:
Inherits: Object
Defined in: actionpack/lib/action_dispatch/request/utils.rb

Class Attribute Summary

Class Method Summary

Instance Attribute Summary

Class Attribute Details

.perform_deep_munge (rw) Also known as: #perform_deep_munge

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 10

mattr_accessor :perform_deep_munge, default: true

Class Method Details

.check_param_encoding(params)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 31

def self.check_param_encoding(params)
  case params
  when Array
    params.each { |element| check_param_encoding(element) }
  when Hash
    params.each_value { |value| check_param_encoding(value) }
  when String
    unless params.valid_encoding?
      # Raise Rack::Utils::InvalidParameterError for consistency with Rack.
      # ActionDispatch::Request#GET will re-raise as a BadRequest error.
      raise Rack::Utils::InvalidParameterError, "Invalid encoding for parameter: #{params.scrub}"
    end
  end
end

.each_param_value(params, &block)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 12

def self.each_param_value(params, &block)
  case params
  when Array
    params.each { |element| each_param_value(element, &block) }
  when Hash
    params.each_value { |value| each_param_value(value, &block) }
  when String
    block.call params
  end
end

.normalize_encode_params(params)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 23

def self.normalize_encode_params(params)
  if perform_deep_munge
    NoNilParamEncoder.normalize_encode_params params
  else
    ParamEncoder.normalize_encode_params params
  end
end

.set_binary_encoding(request, params, controller, action)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 46

def self.set_binary_encoding(request, params, controller, action)
  CustomParamEncoder.encode(request, params, controller, action)
end

Instance Attribute Details

#perform_deep_munge (rw)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 10

mattr_accessor :perform_deep_munge, default: true