Method: Bio::Command.http_post_form
- Defined in:
- lib/bio/command.rb
.http_post_form(http, path, params = nil, header = {}) ⇒ Object
Same as:
http = Net::HTTP.new(...); http.post_form(path, params)
and it uses proxy if an environment variable (same as OpenURI.open_uri) is set. In addition, header
can be set. (Note that Content-Type and Content-Length are automatically set by default.) uri
must be a URI object, params
must be a hash, and header
must be a hash.
Arguments:
-
(required) http: Net::HTTP object or compatible object
-
(required) path: String
-
(optional) params: Hash containing parameters
-
(optional) header: Hash containing header strings
- Returns
-
(same as Net::HTTP::post_form)
481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/bio/command.rb', line 481 def http_post_form(http, path, params = nil, header = {}) data = make_cgi_params(params) hash = { 'Content-Type' => 'application/x-www-form-urlencoded', 'Content-Length' => data.length.to_s } hash.update(header) http.post(path, data, hash) end |