requests-cache / requests-cache

Persistent HTTP cache for python requests
https://requests-cache.readthedocs.io
BSD 2-Clause "Simplified" License
1.34k stars 143 forks source link

Feature request: Don't add 'Cache-Control' request header by configuration. #1014

Open jedie opened 2 months ago

jedie commented 2 months ago

Feature description

Use case

I would like to create requests without the Cache-Control headers.

Workarounds

I see no work-a-round, because requests_cache.policy.directives.set_request_headers() will be always called and will always the Cache-Control header :( (except ugly monkey-patch)

Plan to implement

Yes

EDIT: Discovered that sending DO_NOT_CACHE cause my real problem, because 0x0D0E0200020704 results in a very high max-age and the M$ server doesn't like it ;(

JWCook commented 2 months ago

I see. I can probably fix this without adding another configuration option. DO_NOT_CACHE was intended more as an internal sentinel value rather than something to send in request headers. I'll try to get that fixed soon.