From 6ed591815cc97c2c3c06167d2edc4f17edd4c859 Mon Sep 17 00:00:00 2001 From: Suleman H <39214679+sulemaanhamza@users.noreply.github.com> Date: Thu, 10 Mar 2022 20:18:40 +0500 Subject: [PATCH] [9.x] Fixes HTTP::pool response when a URL returns a null status code (#41412) * Fixes HTTP::pool response when a URL returns a null status code * Updated getResponse() to hasResponse() Co-authored-by: Bogdan Kharchenko <32746389+bogdankharchenko@users.noreply.github.com> Co-authored-by: Bogdan Kharchenko <32746389+bogdankharchenko@users.noreply.github.com> --- src/Illuminate/Http/Client/PendingRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index ff0213324772..40e1d9d88f9b 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -790,7 +790,7 @@ protected function makePromise(string $method, string $url, array $options = []) }); }) ->otherwise(function (TransferException $e) { - return $e instanceof RequestException ? $this->populateResponse(new Response($e->getResponse())) : $e; + return $e instanceof RequestException && $e->hasResponse() ? $this->populateResponse(new Response($e->getResponse())) : $e; }); }