Solving issue #2692

ValueError: count must be a positive integer (got 0)
This commit is contained in:
Hazh. M. Adam 2022-04-04 12:27:55 +08:00 committed by GitHub
parent 933b210f2e
commit 7d8f68c1a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -371,8 +371,8 @@ class Response(object):
if self.is_chunked():
chunk_size = "%X\r\n" % nbytes
self.sock.sendall(chunk_size.encode('utf-8'))
self.sock.sendfile(respiter.filelike, count=nbytes)
if nbytes > 0:
self.sock.sendfile(respiter.filelike, count=nbytes)
if self.is_chunked():
self.sock.sendall(b"\r\n")