Skip to content

Commit 3d88642

Browse files
epixianErich Oelschlegel
andauthored
Allow defining a default handler stack (#475)
allow defining a default handler stack Co-authored-by: Erich Oelschlegel <erich.oelschlegel@owlservices.com>
1 parent 8287a83 commit 3d88642

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/Http/Senders/GuzzleSender.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ public function getFactoryCollection(): FactoryCollection
6666
*/
6767
protected function createGuzzleClient(): GuzzleClient
6868
{
69-
// We'll use HandlerStack::create as it will create a default
70-
// handler stack with the default Guzzle middleware like
71-
// http_errors, cookies etc.
72-
73-
$this->handlerStack = HandlerStack::create();
69+
$this->handlerStack = $this->defaultHandlerStack();
7470

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

85+
/**
86+
* The default handler stack used by the underlying Guzzle client
87+
*/
88+
protected function defaultHandlerStack(): HandlerStack
89+
{
90+
// We'll use HandlerStack::create as it will create a default
91+
// handler stack with the default Guzzle middleware like
92+
// http_errors, cookies etc.
93+
94+
return HandlerStack::create();
95+
}
96+
8997
/**
9098
* Send a synchronous request.
9199
*

0 commit comments

Comments
 (0)