diff --git a/litestar/middleware/response_cache.py b/litestar/middleware/response_cache.py index 8d63d94587..fb9fe71462 100644 --- a/litestar/middleware/response_cache.py +++ b/litestar/middleware/response_cache.py @@ -49,7 +49,7 @@ async def wrapped_send(message: Message) -> None: elif value_or_default(connection_state.do_cache, False): messages.append(message) - if messages and message["type"] == HTTP_RESPONSE_BODY and not message.get('more_body') + if messages and message["type"] == HTTP_RESPONSE_BODY and not message.get('more_body'): key = (route_handler.cache_key_builder or self.config.key_builder)(Request(scope)) store = self.config.get_store_from_app(scope["app"]) await store.set(key, encode_msgpack(messages), expires_in=expires_in)