fix: Add Auth header to individual batch requests

* Fixes an issue where the authorization HTTP header wasn't
  being applied to individual batch requests.

[pr #822, refs #817]
This commit is contained in:
Egor Vorobiev 2019-08-19 21:08:44 +03:00 committed by Mike Moore
parent 71a638b85d
commit 837cf00706
2 changed files with 4 additions and 1 deletions

View File

@ -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)

View File

@ -277,13 +277,14 @@ EOF
--outer
Content-Type: application/http
Content-Id: <b1981e17-f622-49af-b2eb-203308b1b17d+0>
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