form_data=(params)[permalink][rdoc]set_form_data(params, sep = '&') -> ()-
HTMLのフォームのデータ params からヘッダフィールドとボディを設定します。
ヘッダフィールド Content-Type: には 'application/x-www-form-urlencoded' が設定されます。
- [PARAM] params:
- HTML のフォームデータの Hash を与えます。
- [PARAM] sep:
- データのセパレータを文字列で与えます。
例 set_form_datarequire 'net/http' uri = URI.parse('http://www.example.com/index.html') req = Net::HTTP::Get.new(uri.request_uri) req.form_data = {"q" => ["ruby", "perl"], "lang" => "en"} # => {"q"=>["ruby", "perl"], "lang"=>"en"}require 'net/http' uri = URI.parse('http://www.example.com/index.html') req = Net::HTTP::Get.new(uri.request_uri) req.set_form_data({"q" => "ruby", "lang" => "en"}, ';') # => "application/x-www-form-urlencoded"