Allow http command to keep initial query parameters

This commit is contained in:
railscard 2015-12-14 06:16:31 +04:00
parent 6c75e89cfe
commit f51a4f25a9
2 changed files with 9 additions and 1 deletions

View File

@ -143,7 +143,7 @@ module Google
def prepare!
header.update(options.header) if options && options.header
self.url = url.expand(params) if url.is_a?(Addressable::Template)
url.query_values = query
url.query_values = query.merge(url.query_values || {})
end
# Release any resources used by this command

View File

@ -264,4 +264,12 @@ RSpec.describe Google::Apis::Core::HttpCommand do
command.query['a'] = [1,2,3]
command.execute(client)
end
it 'should not remove initial query parameters' do
stub_request(:get, 'https://www.googleapis.com/zoo/animals?a=1&a=2&a=3&foo=bar')
.to_return(status: [200, ''])
command = Google::Apis::Core::HttpCommand.new(:get, 'https://www.googleapis.com/zoo/animals?foo=bar')
command.query['a'] = [1,2,3]
command.execute(client)
end
end