Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Net::HTTP and post_form

Reply
Thread Tools

Net::HTTP and post_form

 
 
Joel VanderWerf
Guest
Posts: n/a
 
      07-22-2008

I expected this to work (since the #post_form method is documented), but
the method is not found:

require 'net/http'

Net::HTTP.start('127.0.0.1', 4567) do |http|
http.post_form('/foo', "bar" => "baz")
end

Here's the error:

http-post-bug.rb:4: undefined method `post_form' for #<Net::HTTP
127.0.0.1:4567 open=false> (NoMethodError)
from /usr/local/lib/ruby/1.8/net/http.rb:543:in `start'
from /usr/local/lib/ruby/1.8/net/http.rb:440:in `start'
from http-post-bug.rb:3


Why isn't post_form usable in the block form? I'm using the block form
because it's actually going thru a proxy.

I can do it myself by creating the request manually:

req = Net::HTTP:ost.new(path)
req.form_data = params
Net::HTTP.new('127.0.0.1', 4567).start {|http|
http.request(req)
}

but it's kind of disappointing.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Net::HTTP#post_form - setting user agent, referrer? Joe Ruby 5 09-21-2007 01:34 PM
Net::HTTP.post_form got 200 but no INSERT INTO. How come? How to fix this? Arie Kusuma Atmaja Ruby 0 09-04-2006 04:08 PM
Net::HTML#post_form with ASP |MKSM| Ruby 4 03-15-2006 01:14 AM
Net::HTTP.post_form missing method error Dan Tenenbaum Ruby 5 03-10-2006 06:46 AM
post_form Fox Ruby 1 02-14-2006 08:42 PM



Advertisments