guzzle-cache-middleware icon indicating copy to clipboard operation
guzzle-cache-middleware copied to clipboard

Writes empty files when using sink

Open shadowhand opened this issue 7 years ago • 3 comments

Whenever I use this middleware when combined with the sink option empty files are written:

$client->get($uri, ['sink' => "$dir/$uri"]);

The file $dir/$uri is created but has no content.

shadowhand avatar Jun 30 '17 17:06 shadowhand

Are you sure that this is this middleware that cause the issue?
The sink option is handled before this middleware.

Can you share/post your code?

Kevinrob avatar Jul 01 '17 21:07 Kevinrob

Yes, I've confirmed that sink works correctly when this middleware is disabled.

Guzzle config is here and here is our calling code, which is currently not using sink due to this issue.

shadowhand avatar Jul 05 '17 19:07 shadowhand

We're also seeing this issue in this project. The workaround of not using sink (and instead writing the response body out to a file after the Guzzle request) seems to work fine.

samwilson avatar Jan 07 '21 02:01 samwilson