Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 24, 2020
1 parent 04694bb commit b718d3a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Illuminate/Http/Client/PendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\HandlerStack;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Illuminate\Support\Traits\Macroable;

Expand Down Expand Up @@ -100,7 +101,7 @@ class PendingRequest
/**
* The middleware callables added by users that will handle requests.
*
* @var \Illuminate\Support\Collection|null
* @var \Illuminate\Support\Collection
*/
protected $middleware;

Expand All @@ -113,6 +114,7 @@ class PendingRequest
public function __construct(Factory $factory = null)
{
$this->factory = $factory;
$this->middleware = new Collection;

$this->asJson();

Expand Down Expand Up @@ -393,16 +395,16 @@ public function withOptions(array $options)
}

/**
* Add new middleware the client handlerstack.
* Add new middleware the client handler stack.
*
* @param callable $middleware
* @return $this
*/
public function withMiddleware(callable $middleware)
{
return tap($this, function ($request) use ($middleware) {
return $this->middleware = collect($this->middleware)->push($middleware);
});
$this->middleware->push($middleware);

return $this;
}

/**
Expand Down Expand Up @@ -620,7 +622,7 @@ public function buildHandlerStack()
$stack->push($this->buildRecorderHandler());
$stack->push($this->buildStubHandler());

collect($this->middleware)->each(function (callable $middleware) use ($stack) {
$this->middleware->each(function ($middleware) use ($stack) {
$stack->push($middleware);
});
});
Expand Down

0 comments on commit b718d3a

Please sign in to comment.