Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/_newsfragments/1920.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The ``headers`` argument of the redirect exceptions
(:class:`~falcon.HTTPMovedPermanently`, :class:`~falcon.HTTPFound`,
:class:`~falcon.HTTPSeeOther`, :class:`~falcon.HTTPTemporaryRedirect`, and
:class:`~falcon.HTTPPermanentRedirect`) is now documented. The accompanying
docstrings clarify that these headers are merged into the ones already set on
the response, and are unrelated to the headers of the incoming request.
15 changes: 15 additions & 0 deletions falcon/redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class HTTPMovedPermanently(HTTPStatus):
Args:
location (str): URI to provide as the Location header in the
response.
headers (dict): Extra headers to add to the response. These are
merged into the headers already set on the response; they
are not related to the headers of the incoming request.
"""

def __init__(self, location: str, headers: Headers | None = None) -> None:
Expand Down Expand Up @@ -70,6 +73,9 @@ class HTTPFound(HTTPStatus):
Args:
location (str): URI to provide as the Location header in the
response.
headers (dict): Extra headers to add to the response. These are
merged into the headers already set on the response; they
are not related to the headers of the incoming request.
"""

def __init__(self, location: str, headers: Headers | None = None) -> None:
Expand Down Expand Up @@ -104,6 +110,9 @@ class HTTPSeeOther(HTTPStatus):
Args:
location (str): URI to provide as the Location header in the
response.
headers (dict): Extra headers to add to the response. These are
merged into the headers already set on the response; they
are not related to the headers of the incoming request.
"""

def __init__(self, location: str, headers: Headers | None = None) -> None:
Expand Down Expand Up @@ -133,6 +142,9 @@ class HTTPTemporaryRedirect(HTTPStatus):
Args:
location (str): URI to provide as the Location header in the
response.
headers (dict): Extra headers to add to the response. These are
merged into the headers already set on the response; they
are not related to the headers of the incoming request.
"""

def __init__(self, location: str, headers: Headers | None = None) -> None:
Expand All @@ -159,6 +171,9 @@ class HTTPPermanentRedirect(HTTPStatus):
Args:
location (str): URI to provide as the Location header in the
response.
headers (dict): Extra headers to add to the response. These are
merged into the headers already set on the response; they
are not related to the headers of the incoming request.
"""

def __init__(self, location: str, headers: Headers | None = None) -> None:
Expand Down
Loading