starlette
starlette copied to clipboard
Support returning Not Modified responses in FileResponse
Summary
Looking at the souce for StaticFiles, it verifies the timestamp/etag and returns HTTP 304 - Not Modified when appropriate.
IMHO it would be simpler / more reusable if this was part of FileResponse.
(I brought this up a few hours ago in #2954, and decided to give it a try)
I haven't written new tests: There already is a ton of them and there is good coverage.
Checklist
- [x] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
- [ ] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
- [ ] I've updated the documentation accordingly.
@abersheeran I know you've played a lot with this. Does this PR make sense?
Hello, is this related to https://github.com/encode/starlette/pull/2891 ?