Skip to content

Commit f3ae904

Browse files
committed
gh-135056: Document response_headers as an instance_attribute.
1 parent 9653710 commit f3ae904

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

Doc/library/http.server.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,7 @@ instantiation, of which this module provides three different variants:
375375
The *directory* parameter accepts a :term:`path-like object`.
376376

377377
.. versionchanged:: next
378-
Added *response_headers*, which accepts an optional iterable of
379-
name/value pairs of HTTP headers to add to each successful HTTP status 200
380-
response. All other status code responses will not include these headers.
378+
Added *response_headers*.
381379

382380
A lot of the work, such as parsing the request, is done by the base class
383381
:class:`BaseHTTPRequestHandler`. This class implements the :func:`do_GET`
@@ -401,6 +399,13 @@ instantiation, of which this module provides three different variants:
401399
This dictionary is no longer filled with the default system mappings,
402400
but only contains overrides.
403401

402+
.. attribute:: response_headers
403+
404+
A sequence of ``(name, value)`` pairs containing user specified custom
405+
HTTP response headers to add to each successful HTTP status 200 response.
406+
All other status code responses will not include these headers.
407+
408+
404409
The :class:`SimpleHTTPRequestHandler` class defines the following methods:
405410

406411
.. method:: do_HEAD()
@@ -433,8 +438,8 @@ instantiation, of which this module provides three different variants:
433438
followed by a ``'Content-Length:'`` header with the file's size and a
434439
``'Last-Modified:'`` header with the file's modification time.
435440

436-
The instance attribute ``response_headers`` is used as an iterable of
437-
name/value pairs to set user specified custom response headers.
441+
The instance attribute ``response_headers`` is a sequence of
442+
``(name, value)`` pairs containing user specified custom response headers.
438443

439444
Then follows a blank line signifying the end of the headers, and then the
440445
contents of the file are output.
@@ -445,9 +450,6 @@ instantiation, of which this module provides three different variants:
445450
.. versionchanged:: 3.7
446451
Support of the ``'If-Modified-Since'`` header.
447452

448-
.. versionchanged:: next
449-
Support ``response_headers`` as an instance argument.
450-
451453
The :class:`SimpleHTTPRequestHandler` class can be used in the following
452454
manner in order to create a very basic webserver serving files relative to
453455
the current directory::

0 commit comments

Comments
 (0)