From 42df1f7f5ef1a13f6065f34dbc5ad1021f17cd66 Mon Sep 17 00:00:00 2001 From: Rafael Moraes <50295204+glomatico@users.noreply.github.com> Date: Mon, 23 Feb 2026 21:44:47 -0300 Subject: [PATCH] Make safe_json return None on parse error --- gamdl/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamdl/utils.py b/gamdl/utils.py index eefa67f..70e7be9 100644 --- a/gamdl/utils.py +++ b/gamdl/utils.py @@ -14,11 +14,11 @@ def raise_for_status(httpx_response: httpx.Response, valid_responses: set[int] = ) -def safe_json(httpx_response: httpx.Response) -> dict: +def safe_json(httpx_response: httpx.Response) -> dict | None: try: return httpx_response.json() except (json.JSONDecodeError, UnicodeDecodeError): - return {} + return None async def get_response(