From 98b363e4fae2200303ad37730eed2ef1b460015d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 18 Sep 2024 16:37:55 +0200 Subject: [PATCH] Add a cache to must_be_empty_body (#9174) --- CHANGES/9174.misc.rst | 1 + aiohttp/helpers.py | 1 + 2 files changed, 2 insertions(+) create mode 100644 CHANGES/9174.misc.rst diff --git a/CHANGES/9174.misc.rst b/CHANGES/9174.misc.rst new file mode 100644 index 00000000000..13dc00ec1de --- /dev/null +++ b/CHANGES/9174.misc.rst @@ -0,0 +1 @@ +Improved performance of web requests -- by :user:`bdraco`. diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py index abbc628261e..bd8c11a3406 100644 --- a/aiohttp/helpers.py +++ b/aiohttp/helpers.py @@ -1099,6 +1099,7 @@ def parse_http_date(date_str: Optional[str]) -> Optional[datetime.datetime]: return None +@functools.lru_cache def must_be_empty_body(method: str, code: int) -> bool: """Check if a request must return an empty body.""" return (