From abb952ad77bdc65a296f5e3be9cfaf55b4b50318 Mon Sep 17 00:00:00 2001 From: doctorpangloss <@hiddenswitch.com> Date: Mon, 1 Apr 2024 20:34:55 -0700 Subject: [PATCH] Tweak headers to accept default when none are specified --- comfy/cmd/server.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/comfy/cmd/server.py b/comfy/cmd/server.py index 84a71fb6f..6beddd324 100644 --- a/comfy/cmd/server.py +++ b/comfy/cmd/server.py @@ -553,6 +553,7 @@ class PromptServer(ExecutorToClientProgress): async def post_prompt(request: web.Request) -> web.Response | web.FileResponse: # check if the queue is too long accept = request.headers.get("accept", "application/json") + content_type = request.headers.get("content-type", "application/json") queue_size = self.prompt_queue.size() queue_too_busy_size = PromptServer.get_too_busy_queue_size() if queue_size > queue_too_busy_size: @@ -560,9 +561,9 @@ class PromptServer(ExecutorToClientProgress): reason=f"the queue has {queue_size} elements and {queue_too_busy_size} is the limit for this worker") # read the request prompt_dict: dict = {} - if request.headers[aiohttp.hdrs.CONTENT_TYPE] == 'application/json': + if content_type == 'application/json': prompt_dict = await request.json() - elif request.headers[aiohttp.hdrs.CONTENT_TYPE] == 'multipart/form-data': + elif content_type == 'multipart/form-data': try: reader = await request.multipart() async for part in reader: