Skip to content

Commit 1ae3d6d

Browse files
committed
Update README to describe chunking
1 parent e194542 commit 1ae3d6d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

README.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,25 @@ poking around in the code itself.
7373
following attributes:
7474

7575
* ``code`` - HTTP response code (int)
76-
* ``content`` - content of next response (str)
76+
* ``content`` - content of next response (str, bytes, or iterable of either)
7777
* ``headers`` - response headers (dict)
78+
* ``chunked`` - whether to chunk-encode the response (enumeration)
7879

79-
Once these attribute are set, all subsequent requests will be answered with
80+
Once these attributes are set, all subsequent requests will be answered with
8081
these values until they are changed or the server is stopped. A more
8182
convenient way to change these is ::
8283

83-
httpserver.serve_content(content=None, code=200, headers=None)
84+
httpserver.serve_content(content=None, code=200, headers=None, chunked=pytest_localserver.http.Chunked.NO)
85+
86+
The ``chunked`` atribute or parameter can be set to
87+
88+
* ``Chunked.YES``, telling the server to always apply chunk encoding
89+
* ``Chunked.NO``, telling the server to never apply chunk encoding
90+
* ``Chunked.AUTO``, telling the server to apply chunk encoding only if
91+
the ``Transfer-Encoding`` header includes ``chunked``
92+
93+
If chunk encoding is applied, each str or bytes in ``content`` becomes one
94+
chunk in the response.
8495

8596
The server address can be found in property
8697

0 commit comments

Comments
 (0)