6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/gcs_stream_upload.rb', line 6
def send_start_command(client)
logger.debug { sprintf('Sending upload start command to %s', url) }
= .dup
apply_request_options()
[UPLOAD_PROTOCOL_HEADER] = RESUMABLE
[UPLOAD_COMMAND_HEADER] = START_COMMAND
if upload_io.respond_to?(:size)
[UPLOAD_CONTENT_LENGTH] = upload_io.size.to_s
end
[UPLOAD_CONTENT_TYPE_HEADER] = upload_content_type
client.request(method.to_s.upcase,
url.to_s, query: nil,
body: body,
header: ,
follow_redirect: true)
rescue => e
raise Google::Apis::ServerError, e.message
end
|