Closed simontabor closed 4 years ago
This appears to be fixed when using ^11.0.0-beta.1
Can you set up a RunKit example please?
I'd also prefer the cache to be decompressed, so each call to the cache uses less CPU.
Please make an issue in the cacheable-request
repository.
Reproduced in the example above, will now make a test.
Fixed in 6ca17e20460685016035fba607fa394efb3e89bf
Describe the bug
v10.15.3
When using the request cache with
decompress: true, responseType: 'json'
, the first request succeeds. For a response with a 60s ttl, the next 60s of requests succeed too.Then, when it comes to revalidating the cache, a 304 response is returned, and an error is thrown.
so
Actual behavior
The cached response is gzipped, which is then not decompressed again (it seems), which means JSON.parse throws an error as it's trying to parse bytes...
Expected behavior
We expect the cached body to be used. I'd also prefer the cache to be decompressed, so each call to the cache uses less CPU.
Code to reproduce
The URL in question responds with
cache-control: public,max-age:60
andetag
headers.Setting
decompress: false
fixes the issueChecklist