You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you cannot "encode" it in the request_url, since that only gets request.url (and would be too long anyway etc)
the cache lookup also gets the "cache_url" only (not the whole request)
the serializer then could return False, but it would mean that there's a misleading log warning, and that only the latest (matching) response would be cached
The text was updated successfully, but these errors were encountered:
This is indeed not possible, for reasons mentioned in both #216 and #337. The TL;DR is that CacheControl is not architecturally set up to cache POSTs, but also that the HTTP RFCs explicitly preclude caching of state-modifying methods like POST.
If you're working in a particular application context where POST caching makes sense, my recommendation is to either do it via your own custom middleware, or handle it at a higher layer (i.e. write an adapter above your session management to divert POSTs that have been cached).
I'd like to cache responses for POST requests, but only for matching
data
/json
(similar to params have to match for GET requests).This however does not appear to be possible easily, is it?
Related code: https://github.com/ionrock/cachecontrol/blob/7a198b41a14ac92cf3766599009326165dcc99cd/cachecontrol/controller.py#L125-L148
request.url
(and would be too long anyway etc)False
, but it would mean that there's a misleading log warning, and that only the latest (matching) response would be cachedThe text was updated successfully, but these errors were encountered: