Project

General

Profile

Actions

Bug #7973

closed

[doc] net/http URI passed to Net::HTTP::Post.new or Net::HTTP::Get.new errors NoMethodError: undefined method `empty?'

Added by danblack (Daniel Black) about 11 years ago. Updated about 11 years ago.

Status:
Rejected
Assignee:
Target version:
-
ruby -v:
ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux]
Backport:
[ruby-core:52956]

Description

http://www.ruby-doc.org/stdlib-2.0/libdoc/net/http/rdoc/Net/HTTP.html documents a URI object being passed to Net::HTTP::Get.new and Net::HTTP::Post.new a few times.

passing a URI to Net::HTTP::Post.new or Net::HTTP::Get.new throws a NoMethodError as the URI doesn't have an empty method.

(({1.9.3p385 :040 > uri = URI('http://www.example.com/search.cgi')
=> #<URI::HTTP:0x000000024ed098 URL:http://www.example.com/search.cgi>
1.9.3p385 :041 > req = Net::HTTP::Post.new(uri)
NoMethodError: undefined method empty?' for #<URI::HTTP:0x000000024ed098> from /usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in initialize'
from /usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in initialize' from (irb):41:in new'
from (irb):41
from /usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in <main>' 1.9.3p385 :042 > req = Net::HTTP::Get.new(uri) NoMethodError: undefined method empty?' for #URI::HTTP:0x000000024ed098
from /usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in initialize' from /usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in initialize'
from (irb):42:in new' from (irb):42 from /usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in '
}))

also fails in ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0