class HTTP::FormData::Urlencoded
`application/x-www-form-urlencoded` form data.
Public Class Methods
new(data)
click to toggle source
@param [#to_h, Hash] data form data key-value Hash
# File lib/http/form_data/urlencoded.rb, line 8 def initialize(data) @data = FormData.ensure_hash data end
Public Instance Methods
content_length()
click to toggle source
Returns form data content size to be used for HTTP request `Content-Length` header.
@return [Fixnum]
# File lib/http/form_data/urlencoded.rb, line 30 def content_length to_s.bytesize end
content_type()
click to toggle source
Returns MIME type to be used for HTTP request `Content-Type` header.
@return [String]
# File lib/http/form_data/urlencoded.rb, line 22 def content_type "application/x-www-form-urlencoded" end
to_s()
click to toggle source
Returns content to be used for HTTP request body.
@return [String]
# File lib/http/form_data/urlencoded.rb, line 15 def to_s ::URI.encode_www_form @data end