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:
parent
71a638b85d
commit
837cf00706
|
@ -177,6 +177,8 @@ module Google
|
||||||
call.header.each do |key, value|
|
call.header.each do |key, value|
|
||||||
request_head << sprintf("\r\n%s: %s", key, value)
|
request_head << sprintf("\r\n%s: %s", key, value)
|
||||||
end
|
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 << sprintf("\r\nHost: %s", call.url.host)
|
||||||
request_head << "\r\n\r\n"
|
request_head << "\r\n\r\n"
|
||||||
StringIO.new(request_head)
|
StringIO.new(request_head)
|
||||||
|
|
|
@ -277,13 +277,14 @@ EOF
|
||||||
--outer
|
--outer
|
||||||
Content-Type: application/http
|
Content-Type: application/http
|
||||||
Content-Id: <b1981e17-f622-49af-b2eb-203308b1b17d+0>
|
Content-Id: <b1981e17-f622-49af-b2eb-203308b1b17d+0>
|
||||||
Content-Length: 349
|
Content-Length: 380
|
||||||
Content-Transfer-Encoding: binary
|
Content-Transfer-Encoding: binary
|
||||||
|
|
||||||
POST /upload/zoo/animals? HTTP/1.1
|
POST /upload/zoo/animals? HTTP/1.1
|
||||||
X-Goog-Api-Client: #{x_goog_api_client_value}
|
X-Goog-Api-Client: #{x_goog_api_client_value}
|
||||||
Content-Type: multipart/related; boundary=inner
|
Content-Type: multipart/related; boundary=inner
|
||||||
X-Goog-Upload-Protocol: multipart
|
X-Goog-Upload-Protocol: multipart
|
||||||
|
Authorization: Bearer a token
|
||||||
Host: www.googleapis.com
|
Host: www.googleapis.com
|
||||||
|
|
||||||
--inner
|
--inner
|
||||||
|
|
Loading…
Reference in New Issue