-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Ignore if-modified-since if if-none-match is present
#3057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Smixi-syn <200990126+Smixi-syn@users.noreply.github.com> Co-authored-by: grindhold <2592640+grindhold@users.noreply.github.com>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <200990126+Smixi-syn@users.noreply.github.com> Co-authored-by: grindhold <2592640+grindhold@users.noreply.github.com>
|
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!