diff --git a/lib/google/apis/core/batch.rb b/lib/google/apis/core/batch.rb index af60ce649..3e55183a4 100644 --- a/lib/google/apis/core/batch.rb +++ b/lib/google/apis/core/batch.rb @@ -177,6 +177,8 @@ module Google call.header.each do |key, value| request_head << sprintf("\r\n%s: %s", key, value) end + token = call.options.authorization + request_head << "\r\nAuthorization: Bearer #{token}" unless token.nil? request_head << sprintf("\r\nHost: %s", call.url.host) request_head << "\r\n\r\n" StringIO.new(request_head) diff --git a/spec/google/apis/core/service_spec.rb b/spec/google/apis/core/service_spec.rb index 39709f947..6d0746eae 100644 --- a/spec/google/apis/core/service_spec.rb +++ b/spec/google/apis/core/service_spec.rb @@ -277,13 +277,14 @@ EOF --outer Content-Type: application/http Content-Id: -Content-Length: 349 +Content-Length: 380 Content-Transfer-Encoding: binary POST /upload/zoo/animals? HTTP/1.1 X-Goog-Api-Client: #{x_goog_api_client_value} Content-Type: multipart/related; boundary=inner X-Goog-Upload-Protocol: multipart +Authorization: Bearer a token Host: www.googleapis.com --inner