diff --git a/lib/restclient/payload.rb b/lib/restclient/payload.rb index 43b779a..916e71c 100644 --- a/lib/restclient/payload.rb +++ b/lib/restclient/payload.rb @@ -61,7 +61,7 @@ module RestClient result += flatten_params(value, calculated_key) elsif value.is_a? Array value.each do |elem| - result << [calculated_key, elem] + result << ["#{calculated_key}[]", elem] end else result << [calculated_key, value] diff --git a/spec/payload_spec.rb b/spec/payload_spec.rb index 85abaf6..4500858 100644 --- a/spec/payload_spec.rb +++ b/spec/payload_spec.rb @@ -33,11 +33,11 @@ describe RestClient::Payload do should == "foo[bar]=baz" end - it "should properyl handle arrays as repeated parameters" do + it "should properly handle arrays as repeated parameters" do RestClient::Payload::UrlEncoded.new({:foo => ['bar']}).to_s. - should == "foo=bar" + should == "foo[]=bar" RestClient::Payload::UrlEncoded.new({:foo => ['bar', 'baz']}).to_s. - should == "foo=bar&foo=baz" + should == "foo[]=bar&foo[]=baz" end end