Project

General

Profile

Feature #7684 ยป set_form_data_string.diff

injekt (Lee Jarvis), 01/11/2013 10:03 PM

View differences:

lib/net/http/header.rb
# http.set_form_data({"q" => "ruby", "lang" => "en"}, ';')
#
def set_form_data(params, sep = '&')
query = URI.encode_www_form(params)
if String === params
query = params
else
query = URI.encode_www_form(params)
end
query.gsub!(/&/, sep) if sep != '&'
self.body = query
self.content_type = 'application/x-www-form-urlencoded'
    (1-1/1)