Fix URI in batched request to allow query parameters
This commit is contained in:
parent
f421551018
commit
ef4c5c1f2f
|
@ -286,7 +286,7 @@ module Google
|
||||||
# the serialized request
|
# the serialized request
|
||||||
def serialize_call(call_id, call)
|
def serialize_call(call_id, call)
|
||||||
method, uri, headers, body = call.to_http_request
|
method, uri, headers, body = call.to_http_request
|
||||||
request = "#{method.to_s.upcase} #{Addressable::URI.parse(uri).path} HTTP/1.1"
|
request = "#{method.to_s.upcase} #{Addressable::URI.parse(uri).request_uri} HTTP/1.1"
|
||||||
headers.each do |header, value|
|
headers.each do |header, value|
|
||||||
request << "\r\n%s: %s" % [header, value]
|
request << "\r\n%s: %s" % [header, value]
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,6 +33,15 @@ describe Google::APIClient::BatchRequest do
|
||||||
end).should raise_error(Google::APIClient::BatchError)
|
end).should raise_error(Google::APIClient::BatchError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should allow query parameters in batch requests' do
|
||||||
|
batch = Google::APIClient::BatchRequest.new
|
||||||
|
batch.add(:uri => 'https://example.com', :parameters => {
|
||||||
|
'a' => '12345'
|
||||||
|
})
|
||||||
|
method, uri, headers, body = batch.to_http_request
|
||||||
|
body.read.should include("/?a=12345")
|
||||||
|
end
|
||||||
|
|
||||||
describe 'with the discovery API' do
|
describe 'with the discovery API' do
|
||||||
before do
|
before do
|
||||||
CLIENT.authorization = nil
|
CLIENT.authorization = nil
|
||||||
|
|
Loading…
Reference in New Issue