S
scott.archer
Is there a way to pass in 2 parameters with the same name to the
Net::Http client in ruby?
It's using a map right now, and it only stores one of the values.
Is this a bug in the Http client implementation?
The http spec allows you to pass in multiple parameters with the same
name.
def get_data(data, in_only='Y')
one = Time.new
url = URI.parse('http://127.0.0.1/ec/data.xml')
req = Net::HTTP:ost.new(url.path)
req.basic_auth 'user', 'pass'
req.set_form_data({'test'=>1, 'test'=>2})
res = Net::HTTP.new(url.host, url.port).start {|http|
http.request(req) }
case res
when Net::HTTPSuccess, Net::HTTPRedirection
xml = res.body
else
res.error!
end
end
Net::Http client in ruby?
It's using a map right now, and it only stores one of the values.
Is this a bug in the Http client implementation?
The http spec allows you to pass in multiple parameters with the same
name.
def get_data(data, in_only='Y')
one = Time.new
url = URI.parse('http://127.0.0.1/ec/data.xml')
req = Net::HTTP:ost.new(url.path)
req.basic_auth 'user', 'pass'
req.set_form_data({'test'=>1, 'test'=>2})
res = Net::HTTP.new(url.host, url.port).start {|http|
http.request(req) }
case res
when Net::HTTPSuccess, Net::HTTPRedirection
xml = res.body
else
res.error!
end
end