From 8b7daaaef280a3df39f21c741516b834530224ed Mon Sep 17 00:00:00 2001 From: VJHack Date: Thu, 12 Sep 2024 20:44:45 -0500 Subject: [PATCH] =?UTF-8?q?ca=E2=80=A0ch=20503=20before=20parsing=20json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/server/tests/features/steps/steps.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/server/tests/features/steps/steps.py b/examples/server/tests/features/steps/steps.py index 822fe4437..0d994af29 100644 --- a/examples/server/tests/features/steps/steps.py +++ b/examples/server/tests/features/steps/steps.py @@ -1208,14 +1208,12 @@ async def wait_for_slots_status(context, while True: async with await session.get(f'{base_url}/slots', params=params) as slots_response: status_code = slots_response.status - try: - slots = await slots_response.json() - except: - slots = await slots_response.text() - if context.debug: - print(f"slots responses {slots}\n") if status_code == 503 and status_code == expected_http_status_code: return + slots = await slots_response.json() + if context.debug: + print(f"slots responses {slots}\n") + if status_code == 200 and status_code == expected_http_status_code: n_slots_idle = sum(1 if slot["state"] == 0 else 0 for slot in slots) n_slots_processing = sum(1 if slot["state"] != 0 else 0 for slot in slots)