Skip to content

Commit

Permalink
allow defining a default handler stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Erich Oelschlegel committed Jan 7, 2025
1 parent c266550 commit e0b8dba
Showing 1 changed file with 13 additions and 5 deletions.
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

0 comments on commit e0b8dba

Please sign in to comment.