From 0211d4b6d3d72751866631bd1efffb09831fdbc0 Mon Sep 17 00:00:00 2001 From: Ryan Biesemeyer Date: Sun, 18 Nov 2012 06:22:25 +0000 Subject: [PATCH] Add test for scenario where semicolon in parameter value gets silently converted to ampersand --- spec/google/api_client/discovery_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/google/api_client/discovery_spec.rb b/spec/google/api_client/discovery_spec.rb index a1741d963..10899ab73 100644 --- a/spec/google/api_client/discovery_spec.rb +++ b/spec/google/api_client/discovery_spec.rb @@ -214,6 +214,23 @@ describe Google::APIClient do conn.verify end + it 'should generate valid requests when parameter value includes semicolon' do + conn = stub_connection do |stub| + # semicolon (;) in parameter value was being converted to + # bare ampersand (&) in 0.4.7. ensure that it gets converted + # to a CGI-escaped semicolon (%3B) instead. + stub.post('/prediction/v1.2/training?data=12345%3B67890') do |env| + env[:body].should == '' + end + end + request = CLIENT.execute( + :api_method => @prediction.training.insert, + :parameters => {'data' => '12345;67890'}, + :connection => conn + ) + conn.verify + end + it 'should generate valid requests when repeated parameters are passed' do pending("This is caused by Faraday's encoding of query parameters.") conn = stub_connection do |stub|