-
Notifications
You must be signed in to change notification settings - Fork 25
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
Gracefully fail when freshness cannot be calculated #104
Conversation
Codecov Report
@@ Coverage Diff @@
## master #104 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 1666 1675 +9
=========================================
+ Hits 1666 1675 +9
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
Thank you very much; that makes sense. So RFC 9111 says:
That means we should re-validate the response instead of raising a |
Can you please add a test and changelog for this PR? Here is how to test it: def test_freshness_lifetime_invalid_information():
controller = Controller()
response = Response(
status=200,
)
original_request = Request("GET", "https://example.com")
request = Request("GET", "https://example.com")
conditional_request = controller.construct_response_from_cache(
request=request, response=response, original_request=original_request
)
assert isinstance(conditional_request, Request) |
Requested changes made! I also confirmed that the new test added actually tests for this change (I wrote the test, reverted the change to _controller.py, confirmed failing, restored change to _controller.py, test now passes). |
Great job! Thank you @parkerhancock |
This is a simple change to remove a Runtime Error when a freshness can't be calculated. If freshness can't be calculated, then the request should be sent, rather than error out.