From 9be6dedc4e56a28a298c374f98df5a32cf26aa79 Mon Sep 17 00:00:00 2001 From: Suleman Hamza Date: Wed, 9 Mar 2022 22:38:22 +0500 Subject: [PATCH 1/2] Fixes HTTP::pool response when a URL returns a null status code --- 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..5ab2ec45fbaa 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->getResponse() ? $this->populateResponse(new Response($e->getResponse())) : $e; }); } From 10f3e872855dccab704c0a1dfc27215b66685579 Mon Sep 17 00:00:00 2001 From: Suleman H <39214679+sulemaanhamza@users.noreply.github.com> Date: Thu, 10 Mar 2022 09:06:37 +0500 Subject: [PATCH 2/2] Updated getResponse() to hasResponse() 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 5ab2ec45fbaa..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 && $e->getResponse() ? $this->populateResponse(new Response($e->getResponse())) : $e; + return $e instanceof RequestException && $e->hasResponse() ? $this->populateResponse(new Response($e->getResponse())) : $e; }); }