You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🐣 Is your feature request related to a problem? Please describe. web.FileResponse currently does not allow overriding "Last-Modified" header via last_modified attribute (while parent web.StreamResponse allows it). FileResponse instead always sets actual file mtime even if last_modified attribute has been set before.
if self.last_modified is None:
self.last_modified = st.st_mtime
So that self.last_modified does not get reset by prepare() method if it has been set explicitly.
❓ Describe alternatives you've considered
Also considered setting header directly via headers={"Last-Modified": ...} but it doesn't work (obviously it is not the correct way).
📋 Additional context
In order to also mimic "Last-Modified" removal (like in web.StreamResponse) extra steps are required:
Insert empty last_modified header in init: self._headers[hdrs.LAST_MODIFIED] = None
Extend check to see if it has been explicitly removed (same line 148):
if self.last_modified is None and hdrs.LAST_MODIFIED in self._headers:
self.last_modified = st.st_mtime
The text was updated successfully, but these errors were encountered:
🐣 Is your feature request related to a problem? Please describe.
web.FileResponse
currently does not allow overriding "Last-Modified" header vialast_modified
attribute (while parentweb.StreamResponse
allows it).FileResponse
instead always sets actual file mtime even if last_modified attribute has been set before.💡 Describe the solution you'd like
Change line: https://github.com/aio-libs/aiohttp/blob/master/aiohttp/web_fileresponse.py#L148 to:
So that
self.last_modified
does not get reset byprepare()
method if it has been set explicitly.❓ Describe alternatives you've considered
Also considered setting header directly via
headers={"Last-Modified": ...}
but it doesn't work (obviously it is not the correct way).📋 Additional context
In order to also mimic "Last-Modified" removal (like in web.StreamResponse) extra steps are required:
self._headers[hdrs.LAST_MODIFIED] = None
The text was updated successfully, but these errors were encountered: