Ignore if-modified-since if if-none-match is present#3057
Conversation
Co-authored-by: Smixi-syn <[email protected]> Co-authored-by: grindhold <[email protected]>
if-none-match\ is present, \if-modified-since\ is ignoredif-none-match is present, if-modified-since is ignored
if-none-match is present, if-modified-since is ignoredif-modified-since if if-none-match is present
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the ETag validation logic in the StaticFiles.is_not_modified method and adds test coverage for the RFC 7232 behavior where if-none-match takes precedence over if-modified-since.
- Simplified the ETag matching logic using a walrus operator and removed unnecessary try-except block
- Added test case verifying that
if-none-matchheader is evaluated independently ofif-modified-since
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| starlette/staticfiles.py | Refactored is_not_modified method to use walrus operator and return ETag match result directly |
| tests/test_staticfiles.py | Added test case for ETag mismatch with timestamp match to verify header precedence behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
awesome! thanks for taking action so quickly :) |
Co-authored-by: Smixi-syn <[email protected]> Co-authored-by: grindhold <[email protected]>
|
Hi, thanks for the merge :) ! |
It's not. I've added a note there - people would be able to track the problem easily if they do something weird. |
I've added both @Smixi-syn and @grindhold as co-authors. Thanks for the help!