From a74241805f4d5011d71033d9fc618717982e4ac7 Mon Sep 17 00:00:00 2001 From: ilumos Date: Fri, 15 Jul 2022 20:29:49 +0100 Subject: [PATCH] Throw an exception on empty response --- src/Syntax/SteamApi/Client.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Syntax/SteamApi/Client.php b/src/Syntax/SteamApi/Client.php index 846ca0a..73f0ba5 100644 --- a/src/Syntax/SteamApi/Client.php +++ b/src/Syntax/SteamApi/Client.php @@ -199,6 +199,11 @@ protected function sendRequest(Request $request) } catch (Exception $e) { throw new ApiCallFailedException($e->getMessage(), $e->getCode(), $e); } + + // For some resources, the Steam API responds with an empty response + if (empty($result->body)) { + throw new ApiCallFailedException('API call failed due to empty response', $result->code); + } // If all worked out, return the result return $result;