class HTTP::FormData::Urlencoded

‘application/x-www-form-urlencoded` form data.

def content_type

Returns:
  • (String) -

Other tags:
    Api: - public
def content_type
  "application/x-www-form-urlencoded"
end

def encoder

Returns:
  • (#call) -

Other tags:
    See: .encoder= -

Other tags:
    Api: - public
def encoder
  @encoder || DefaultEncoder
end

def encoder=(implementation)

Returns:
  • (void) -

Parameters:
  • implementation (#call) --

Raises:
  • (ArgumentError) - if implementation does not respond to `#call`

Other tags:
    Api: - public
def encoder=(implementation)
  raise ArgumentError unless implementation.respond_to? :call
  @encoder = implementation
end

def initialize(data, encoder: nil)

Parameters:
  • encoder (#call) -- custom encoder implementation
  • data (Enumerable, Hash, #to_h) -- form data key-value pairs

Other tags:
    Api: - public
def initialize(data, encoder: nil)
  encoder ||= self.class.encoder
  @io = StringIO.new(encoder.call(FormData.ensure_data(data)))
end