-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Closed
Labels
Description
Good day.
I found some conflict (as I see it) between RedirectResponse class and openapi schema.
class RedirectResponse(Response):
def __init__(
self,
url: typing.Union[str, URL],
status_code: int = 307,
headers: dict = None,
background: BackgroundTask = None,
) -> None:
super().__init__(
content=b"", status_code=status_code, headers=headers, background=background
)
self.headers["location"] = quote_plus(str(url), safe=":/%#?&=@[]!$&'()*+,;")We can't define a content. But only 304 status code (of the redirect codes) really can't have a body.
This fact and STATUS_CODES_WITH_NO_BODY = {..., 304} makes a trouble with openapi schema validation.
May be, we should allow set a content with check for the 304 status_code (and nullify content if it is)?
Reactions are currently unavailable