-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
hard error for bad max-age #1809
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1809 +/- ##
=======================================
Coverage 91.94% 91.94%
=======================================
Files 23 23
Lines 2309 2309
Branches 428 428
=======================================
Hits 2123 2123
Misses 143 143
Partials 43 43
Continue to review full report at Codecov.
|
Would you care to elaborate on the choice of type checking logic, and on the change to make non-integer float in tests a failure? |
Hey @Tronic, sure, sorry. First, here's a bit of context that I maybe didn't cover in my issue very clearly. I had some code that set this attribute as a It actually took me quite a while to figure out this was the problem for multiple reasons:
I hope that makes some sense. Would you agree? Sorry if this pull request comes across pedantic, I just felt like I lost quite a lot of time to this and that I could save others the same trouble. |
Python uses float seconds as its basic time unit, so any time calculation like Negative values should probably also be considered errors (raise ValueError?). |
Ah yes, hadn't considered negatives, I can add a check for that. your example is exactly my original code that produced this problem in the first place for me :). I had considered doing a floor or ceiling automatically on the value, but felt that is a similar problem as the original error. The Sanic implementation making an implicit choice for you that you may not expect. Though I'm not too picky, and the expires = datetime(2000, 1,1,3, 2, 1, 999999)
expires.strftime("%a, %d-%b-%Y %T GMT")
'Sat, 01-Jan-2000 03:02:01 GMT' I'll add those changes. Thanks |
Related #1457 with similar intention. |
I’ll close this seeing that this has been addressed in another issue |
See: #1810
Thanks