MCPcopy Create free account
hub / github.com/benoitc/gunicorn / test_chunked_body

Method test_chunked_body

tests/test_python_protocol.py:116–137  ·  view source on GitHub ↗

Test chunked transfer encoding.

(self)

Source from the content-addressed store, hash-verified

114 assert b"".join(body_chunks) == b"name=testuser"
115
116 def test_chunked_body(self):
117 """Test chunked transfer encoding."""
118 body_chunks = []
119
120 parser = PythonProtocol(
121 on_body=lambda chunk: body_chunks.append(chunk),
122 )
123
124 data = (
125 b"POST / HTTP/1.1\r\n"
126 b"Host: example.com\r\n"
127 b"Transfer-Encoding: chunked\r\n"
128 b"\r\n"
129 b"5\r\nhello\r\n"
130 b"6\r\n world\r\n"
131 b"0\r\n\r\n"
132 )
133 parser.feed(data)
134
135 assert parser.is_chunked is True
136 assert parser.is_complete is True
137 assert b"".join(body_chunks) == b"hello world"
138
139 def test_chunked_with_extension(self):
140 """Test chunked with chunk extension."""

Callers

nothing calls this directly

Calls 2

feedMethod · 0.95
PythonProtocolClass · 0.90

Tested by

no test coverage detected