diff --git a/motor/aiohttp/__init__.py b/motor/aiohttp/__init__.py index 16220e76..eb3dc86f 100644 --- a/motor/aiohttp/__init__.py +++ b/motor/aiohttp/__init__.py @@ -248,7 +248,7 @@ def _set_standard_headers(self, path, resp, gridout, checksum): if cache_time > 0: resp.headers["Expires"] = ( - datetime.datetime.now(datetime.timezone.utc) + datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None) + datetime.timedelta(seconds=cache_time) ).strftime("%a, %d %b %Y %H:%M:%S GMT") diff --git a/motor/web.py b/motor/web.py index aa6fc2d5..4cce6d71 100644 --- a/motor/web.py +++ b/motor/web.py @@ -126,7 +126,7 @@ async def get(self, path, include_body=True): if cache_time > 0: self.set_header( "Expires", - datetime.datetime.now(datetime.timezone.utc) + datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None) + datetime.timedelta(seconds=cache_time), ) self.set_header("Cache-Control", "max-age=" + str(cache_time)) diff --git a/pyproject.toml b/pyproject.toml index a79acece..c34a6126 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,6 +112,8 @@ filterwarnings = [ "ignore: The fetch_next property is deprecated:DeprecationWarning", "ignore:The next_object method is deprecated:DeprecationWarning", "ignore:unclosed