Skip to content

Commit 78fd506

Browse files
authored
fix(core): do not reset query_values in case of form encoding (#11654)
1 parent a77c953 commit 78fd506

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

google-apis-core/lib/google/apis/core/http_command.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ def prepare!
168168
@form_encoded = true
169169
self.body = Addressable::URI.form_encode(url.query_values(Array))
170170
self.header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
171-
self.url.query_values = {}
172171
else
173172
@form_encoded = false
174173
end

google-apis-core/spec/google/apis/core/http_command_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,7 @@ class DecryptResponse
444444
end
445445

446446
it 'should form encode parameters when method is POST and no body present' do
447-
stub_request(:post, 'https://www.googleapis.com/zoo/animals')
448-
.with(body: 'a=1&a=2&a=3&b=hello&c=&d=0')
447+
stub_request(:post, 'https://www.googleapis.com/zoo/animals?a=1&a=2&a=3&b=hello&c&d=0')
449448
.to_return(status: [200, ''])
450449
command = Google::Apis::Core::HttpCommand.new(:post, 'https://www.googleapis.com/zoo/animals')
451450
command.query['a'] = [1,2,3]

0 commit comments

Comments
 (0)