Set content length for media uploads
authorSteven Bazyl <sqrrrl@gmail.com>
Wed, 22 Jan 2014 23:32:35 +0000 (15:32 -0800)
committerSteven Bazyl <sqrrrl@gmail.com>
Wed, 22 Jan 2014 23:32:35 +0000 (15:32 -0800)
lib/google/api_client/request.rb

index 2004f80dfeca5278944169a24608e27c48c1e6f1..a8a83c4a42ae87c0e7394c42d8693550cdbb273e 100644 (file)
@@ -287,6 +287,7 @@ module Google
             raise ArgumentError, "Can not specify body & body object for simple uploads"
           end
           self.headers['Content-Type'] ||= self.media.content_type
+          self.headers['Content-Length'] ||= self.media.length.to_s
           self.body = self.media
         when "multipart"
           unless options[:body_object]