Home / Function/ test_chunked_encoding_error() — requests Function Reference

test_chunked_encoding_error() — requests Function Reference

Architecture documentation for the test_chunked_encoding_error() function in test_lowlevel.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  0efab54c_bc4b_14c9_fbe2_34c0ff6e100e["test_chunked_encoding_error()"]
  48561d17_8bd1_bf20_5710_ec3053a534d2["test_lowlevel.py"]
  0efab54c_bc4b_14c9_fbe2_34c0ff6e100e -->|defined in| 48561d17_8bd1_bf20_5710_ec3053a534d2
  7ab3c4d7_8531_6cbe_e871_9880cb1ee6de["consume_socket_content()"]
  0efab54c_bc4b_14c9_fbe2_34c0ff6e100e -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  style 0efab54c_bc4b_14c9_fbe2_34c0ff6e100e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_lowlevel.py lines 39–60

def test_chunked_encoding_error():
    """get a ChunkedEncodingError if the server returns a bad response"""

    def incomplete_chunked_response_handler(sock):
        request_content = consume_socket_content(sock, timeout=0.5)

        # The server never ends the request and doesn't provide any valid chunks
        sock.send(
            b"HTTP/1.1 200 OK\r\n"
            b"Transfer-Encoding: chunked\r\n"
        )

        return request_content

    close_server = threading.Event()
    server = Server(incomplete_chunked_response_handler)

    with server as (host, port):
        url = f"http://{host}:{port}/"
        with pytest.raises(requests.exceptions.ChunkedEncodingError):
            requests.get(url)
        close_server.set()  # release server block

Domain

Subdomains

Frequently Asked Questions

What does test_chunked_encoding_error() do?
test_chunked_encoding_error() is a function in the requests codebase, defined in tests/test_lowlevel.py.
Where is test_chunked_encoding_error() defined?
test_chunked_encoding_error() is defined in tests/test_lowlevel.py at line 39.
What does test_chunked_encoding_error() call?
test_chunked_encoding_error() calls 1 function(s): consume_socket_content.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free