From: Robert Klemme Date: 2007-04-20T18:00:08+09:00 Subject: Re: Multiple Parameters with Net:Http On 19.04.2007 23:53, scott.archer@gmail.com wrote: > 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::Post.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 Without trying I'd assume that it should work like this: req.set_form_data({'test'=>[1, 2]}) btw, you can leave out the curlys req.set_form_data('test'=>[1, 2]) Kind regards robert