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?