tornado: Stop supporting HEAD requests.

These are not part of the API, and lead to moderately confusing
behaviour -- they block (or not) requested, but of course send no
actual data in the body.
This commit is contained in:
Alex Vandiver 2023-12-07 21:15:32 +00:00 committed by Tim Abbott
parent 875622fe57
commit 8eccb3af20
1 changed files with 1 additions and 5 deletions

View File

@ -83,7 +83,7 @@ def finish_handler(handler_id: int, event_queue_id: str, contents: List[Dict[str
class AsyncDjangoHandler(tornado.web.RequestHandler): class AsyncDjangoHandler(tornado.web.RequestHandler):
handler_id: int handler_id: int
SUPPORTED_METHODS: Collection[str] = {"GET", "HEAD", "POST", "DELETE"} # type: ignore[assignment] # https://github.com/tornadoweb/tornado/pull/3354 SUPPORTED_METHODS: Collection[str] = {"GET", "POST", "DELETE"} # type: ignore[assignment] # https://github.com/tornadoweb/tornado/pull/3354
@override @override
def initialize(self, django_handler: base.BaseHandler) -> None: def initialize(self, django_handler: base.BaseHandler) -> None:
@ -197,10 +197,6 @@ class AsyncDjangoHandler(tornado.web.RequestHandler):
# connections. # connections.
await sync_to_async(response.close, thread_sensitive=True)() await sync_to_async(response.close, thread_sensitive=True)()
@override
async def head(self, *args: Any, **kwargs: Any) -> None:
await self.get(*args, **kwargs)
@override @override
async def post(self, *args: Any, **kwargs: Any) -> None: async def post(self, *args: Any, **kwargs: Any) -> None:
await self.get(*args, **kwargs) await self.get(*args, **kwargs)