Skip to content

Commit

Permalink
Fix #3186: Return empty bytes with end-of-chunk marker in empty strea…
Browse files Browse the repository at this point in the history
…m reader.
  • Loading branch information
asvetlov committed Sep 26, 2018
1 parent da75122 commit b4063a9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/3186.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return empty bytes with end-of-chunk marker in empty stream reader.
2 changes: 1 addition & 1 deletion aiohttp/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ async def readany(self) -> bytes:
return b''

async def readchunk(self) -> Tuple[bytes, bool]:
return (b'', False)
return (b'', True)

async def readexactly(self, n: int) -> bytes:
raise asyncio.streams.IncompleteReadError(b'', n)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ async def test_empty_stream_reader() -> None:
assert await s.read() == b''
assert await s.readline() == b''
assert await s.readany() == b''
assert await s.readchunk() == (b'', False)
assert await s.readchunk() == (b'', True)
with pytest.raises(asyncio.IncompleteReadError):
await s.readexactly(10)
assert s.read_nowait() == b''
Expand Down

0 comments on commit b4063a9

Please sign in to comment.