Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow defining a default handler stack #475

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/Http/Senders/GuzzleSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ public function getFactoryCollection(): FactoryCollection
*/
protected function createGuzzleClient(): GuzzleClient
{
// We'll use HandlerStack::create as it will create a default
// handler stack with the default Guzzle middleware like
// http_errors, cookies etc.

$this->handlerStack = HandlerStack::create();
$this->handlerStack = $this->defaultHandlerStack();

// Now we'll return new Guzzle client with some default request
// options configured. We'll also define the handler stack we
Expand All @@ -86,6 +82,18 @@ protected function createGuzzleClient(): GuzzleClient
]);
}

/**
* The default handler stack used by the underlying Guzzle client
*/
protected function defaultHandlerStack(): HandlerStack
{
// We'll use HandlerStack::create as it will create a default
// handler stack with the default Guzzle middleware like
// http_errors, cookies etc.

return HandlerStack::create();
}

/**
* Send a synchronous request.
*
Expand Down