I am trying to subit some xml data over https to access an API. My code so far seems to generate a very non-helpful error in the guts of the net/http library. This code produces a NoMethodError for nil.strip" require 'net/http' require 'net/https' require 'uri' url = URI.parse('www.beautifulpixel.com/index.html') connection = Net::HTTP.new(url.host, 443) connection.use_ssl = true #This is the line that causes an error response = connection.request(Net::HTTP::Post.new(url.path, request_body)) #The error occured while evaluating nil.strip # from c:/ruby/lib/ruby/1.8/net/http.rb:1138:in `initialize_http_header' # from c:/ruby/lib/ruby/1.8/net/http.rb:1136:in `initialize_http_header' # from c:/ruby/lib/ruby/1.8/net/http.rb:1443:in `initialize' # from c:/ruby/lib/ruby/1.8/net/http.rb:1556:in `initialize' # from ./lib/ups_api.rb:74:in `initialize' # from (irb):13 What am I missing here?
on 2006-05-03 04:46
on 2006-05-03 21:06
2006/5/3, Alex W. <email@example.com>: > connection.use_ssl = true > > #This is the line that causes an error > response = connection.request(Net::HTTP::Post.new(url.path, > request_body)) > > What am I missing here? I guess that : irb(main):001:0> require 'uri' => true irb(main):002:0> URI.parse('www.beautifulpixel.com/index.html').host => nil irb(main):003:0> URI.parse('http://www.beautifulpixel.com/index.html').host => "www.beautifulpixel.com" irb(main):004:0> -- Jean-FranÃ§ois.