-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add support for conditional requests with ETag and Last-Modified headers #79
Comments
I have a workaround implemented which can be found here: https://github.com/netomi/otterdog/blob/main/otterdog/providers/github/rest/requester.py#L182 I am willing to work on a patch to have this integrated in this library by default. Something that I noticed while working on the workaround: when using session.disabled() to temporarily disable the cache, this is only valid for getting requests from the cache, the cache itself is still updated with responses received from the remote server, this should be fixed imho, as it is misleading, will create a separate ticket for it. |
That would be great! Thank you.
That's not the intended behavior, and this is supposed to be handled here. Thanks for the heads up. |
Created #182 to illustrate the problem. The problem is that there are 2 ways to determine whether the cache is used. Via the cache actions and the is_cacheable method which leads to very wrong behavior when the cache is disabled which is hidden from the user. I just noticed some problems as strangely some cached responses got removed and I wanted to understand why. |
Quick summary of how this would work:
ETag
header, add anIf-None-Match
header to the new requestLast-Modified
header, add anIf-Modified-Since
header to the new request304 Not Modified
response is received, return the cached response and update expiration and headers (if changed)200
response is received, update the cache and return the new responseThe text was updated successfully, but these errors were encountered: