Skip to content

Commit

Permalink
Allow http command to keep initial query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
railscard committed Dec 14, 2015
1 parent 6c75e89 commit f51a4f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/google/apis/core/http_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def authorization_refreshable?
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
Expand Down
8 changes: 8 additions & 0 deletions spec/google/apis/core/http_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,12 @@
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

0 comments on commit f51a4f2

Please sign in to comment.