Skip to content

Conversation

SjorsO
Copy link
Contributor

@SjorsO SjorsO commented Jul 31, 2020

The Guzzle sink option allows you to save the body of the response directly to a file or resource. When using the Http client, sink works normally. As soon as you call Http::fake(), the sink option stops working, making it impossible to test code that uses the sink option.

This PR adds support for two common sink use-cases: saving to a file and writing to a stream. There might be more ways to use the sink option, but I couldn't figure out exactly how Guzzle handles sinking. We can fix other use-cases once people run into them.

This PR also adds a sink() method to the PendingRequest class. This makes it easier to use the option, and allows IDEs to help with auto completion.


Fixes #33557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Http::withOptions('sink' => $path) has no effect with Http::fake
2 participants