getsentry / responses

A utility for mocking out the Python Requests library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`delete` with content will fail

JohnVillalovos opened this issue · comments

Describe the bug

Reproducer in #655

    def generate():
        # Special case for urllib3.
        if hasattr(self.raw, "stream"):
            try:
                yield from self.raw.stream(chunk_size, decode_content=True)
            except ProtocolError as e:
>               raise ChunkedEncodingError(e)
E               requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(29 bytes read, -29 more expected)', IncompleteRead(29 bytes read, -29 more expected))

Additional context

No response

Version of responses

0.23.2

Steps to Reproduce

Use #655 and run tox

Expected Result

No error

Actual Result

Error

So after further investigation this seems a requests issue where if it is a 204 (No Content) then it sets the expected length to 0.