Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac8df21

Browse files
committed
ensure content-length response header is set
1 parent 77c63c9 commit ac8df21

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

googleapiclient/http.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,10 @@ def next_chunk(self, num_retries=0):
559559
content_range = resp['content-range']
560560
length = content_range.rsplit('/', 1)[1]
561561
self._total_size = int(length)
562-
else:
562+
elif 'content-length' in resp:
563563
self._total_size = int(resp['content-length'])
564+
else:
565+
raise HttpError(resp, content, uri=self._uri)
564566

565567
if self._progress == self._total_size:
566568
self._done = True

0 commit comments

Comments
 (0)