Skip to content
Discussion options

You must be logged in to vote

Thanks! Adding this test case to tests/test_decoders.py will expose the bug:

@pytest.mark.parametrize( ["data", "expected"], [((b"Hello,", b" world!"), ["Hello,", " world!"])],)deftest_streaming_iter_text(data: typing.Iterable[bytes], expected: typing.List[str]):
response=httpx.Response(200, content=iter(data))
assertlist(response.iter_text()) ==expected

The issue seems to come from TextChunker.decode:

  1. Decoder (both IdentityDecoder and TextDecoder) emits a empty value
  2. ByteChunker().decode(b"") returns [], but TextChunker().decode("") returns [""]

I traced the cause to some missing logic in TextChunker.decode that ByteChunker.decode has, so I opened #2998

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jamesbraza
Comment options

Answer selected bylovelydinosaur
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
@jamesbraza@lovelydinosaur