Multipart upload compatibility with 1.8.7
This commit is contained in:
parent
eec8c167cb
commit
11bae1fde0
|
@ -66,17 +66,17 @@ module Google
|
||||||
:request => { :boundary => MULTIPART_BOUNDARY }
|
:request => { :boundary => MULTIPART_BOUNDARY }
|
||||||
}
|
}
|
||||||
multipart = Faraday::Request::Multipart.new
|
multipart = Faraday::Request::Multipart.new
|
||||||
self.body = multipart.create_multipart(env, {
|
self.body = multipart.create_multipart(env, [
|
||||||
:metadata => Faraday::UploadIO.new(metadata, 'application/json'),
|
[nil,Faraday::UploadIO.new(metadata, 'application/json', 'file.json')],
|
||||||
:content => self.media})
|
[nil, self.media]])
|
||||||
self.headers.update(env[:request_headers])
|
self.headers.update(env[:request_headers])
|
||||||
when "resumable"
|
when "resumable"
|
||||||
file_length = self.media.length
|
file_length = self.media.length
|
||||||
self.headers['X-Upload-Content-Type'] = self.media.content_type
|
self.headers['X-Upload-Content-Type'] = self.media.content_type
|
||||||
self.headers['X-Upload-Content-Length'] = file_length.to_s
|
self.headers['X-Upload-Content-Length'] = file_length.to_s
|
||||||
if options[:body_object]
|
if options[:body_object]
|
||||||
self.headers['Content-Type'] ||= 'application/json'
|
self.headers['Content-Type'] ||= 'application/json'
|
||||||
self.body = serialize_body(options[:body_object])
|
self.body = serialize_body(options[:body_object])
|
||||||
else
|
else
|
||||||
self.body = ''
|
self.body = ''
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue