`application/x-www-form-urlencoded` form data.
@param [#to_h, Hash] data form data key-value Hash
# File lib/http/form_data/urlencoded.rb, line 10 def initialize(data) @data = FormData.ensure_hash data end
Returns form data content size to be used for HTTP request `Content-Length` header.
@return [Integer]
# File lib/http/form_data/urlencoded.rb, line 32 def content_length to_s.bytesize end
Returns MIME type to be used for HTTP request `Content-Type` header.
@return [String]
# File lib/http/form_data/urlencoded.rb, line 24 def content_type "application/x-www-form-urlencoded" end
Returns content to be used for HTTP request body.
@return [String]
# File lib/http/form_data/urlencoded.rb, line 17 def to_s ::URI.encode_www_form @data end