From 42116a1f8a20a675df663eede88824765f69a475 Mon Sep 17 00:00:00 2001 From: josephrocca <1167575+josephrocca@users.noreply.github.com> Date: Sat, 31 May 2025 02:32:32 +0800 Subject: [PATCH] handle case where request body is empty --- server.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server.py b/server.py index 3ee7bad41..c2ff3edf4 100644 --- a/server.py +++ b/server.py @@ -685,12 +685,13 @@ class PromptServer(): @routes.post("/interrupt") async def post_interrupt(request): - json_data = await request.json() - if "id" in json_data: - current_queue = self.prompt_queue.get_current_queue_volatile() - queue_running = current_queue[0] - if len(queue_running) > 0 and queue_running[0][1] == json_data["id"]: - nodes.interrupt_processing() + if request.can_read_body: + json_data = await request.json() + if "id" in json_data: + current_queue = self.prompt_queue.get_current_queue_volatile() + queue_running = current_queue[0] + if len(queue_running) > 0 and queue_running[0][1] == json_data["id"]: + nodes.interrupt_processing() else: nodes.interrupt_processing() return web.Response(status=200)