Fix #292 - ensure multivalued parameters are encoded correctly

This commit is contained in:
Steve Bazyl committed 2015-10-02 13:31:19 -07:00
1 parent 549e4bd113
commit 81a061cb80
3 files changed
+23 -10

No files matched your search

+13 -5
View File
@@ -123,13 +123,13 @@ RSpec.describe Google::Apis::Core::HttpCommand do
command.options.retries = 1
expect { command.execute(client) }.to raise_error(Google::Apis::ServerError)
end
context('with retries exceeded') do
before(:example) do
command.options.retries = 1
end
let(:err) do
begin
command.execute(client)
@@ -137,13 +137,13 @@ RSpec.describe Google::Apis::Core::HttpCommand do
e
end
end
it 'should raise error with HTTP status code' do
expect(err.status_code).to eq 500
end
end
context('with callbacks') do
it 'should return the response body after retries' do
expect { |b| command.execute(client, &b) }.to yield_successive_args(
@@ -255,4 +255,12 @@ RSpec.describe Google::Apis::Core::HttpCommand do
expect { |b| command.execute(client, &b) }.to yield_with_args(nil, an_instance_of(Google::Apis::ClientError))
end
end
it 'should send repeated query parameters' do
stub_request(:get, 'https://www.googleapis.com/zoo/animals?a=1&a=2&a=3')
.to_return(status: [200, ''])
command = Google::Apis::Core::HttpCommand.new(:get, 'https://www.googleapis.com/zoo/animals')
command.query['a'] = [1,2,3]
command.execute(client)
end
end
+1 -1
View File
@@ -60,6 +60,7 @@ RSpec.configure do |config|
config.capture_log_messages
Google::Apis.logger.level = Logger::DEBUG
WebMock::Config.instance.query_values_notation = :flat_array
end
[JsonSpec::Matchers::BeJsonEql,
@@ -121,4 +122,3 @@ end
def run_integration_tests?
ENV['GOOGLE_APPLICATION_CREDENTIALS'] && ENV['GOOGLE_PROJECT_ID']
end