Overriding caching behaviour (cache even if remote host told me to not do that) #746
Open
1 task done
Labels
💵 Funded on Issuehunt
The issue has been funded on Issuehunt
enhancement
This change will extend Got features
external
The issue related to an external project
What would you like to discuss?
I'd like to override got caching so to extend what the remote headers ask me to do.
I currently use the
max-stale
in the request header to extend somehow the caching, but this doesn't work if the remote service use strict caching headers and got doesn't even store them.I tried manipulating response headers in the
.on('response', )
hook, but this doesn't work. Sounds like got caches the manipulated response, but the cachecontrol is precomputed into a different property and uses the original cache-control.I guess this is something happending in
cacheable-request
makeRequest's response handler that calls theee.emit('response')
AFTER storing the response, so maybe I should open an issue against the "cacheable-request" project, but my knowledge of got internals is very limited, so I preferred to start with this question as maybe you can identify a better way or a workaround to alter if and how long got caches a result.Checklist
The text was updated successfully, but these errors were encountered: