mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-15 22:27:34 +08:00
Add exclude_none=True to create/upload responses
Align with get/update/list endpoints for consistent JSON output. Amp-Thread-ID: https://ampcode.com/threads/T-019ce377-8bde-7048-bc28-a9df063409f9 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
parent
aef0330555
commit
1ed31e232b
@ -360,7 +360,7 @@ async def create_asset_from_hash_route(request: web.Request) -> web.Response:
|
|||||||
**asset.model_dump(),
|
**asset.model_dump(),
|
||||||
created_new=result.created_new,
|
created_new=result.created_new,
|
||||||
)
|
)
|
||||||
return web.json_response(payload_out.model_dump(mode="json"), status=201)
|
return web.json_response(payload_out.model_dump(mode="json", exclude_none=True), status=201)
|
||||||
|
|
||||||
|
|
||||||
@ROUTES.post("/api/assets")
|
@ROUTES.post("/api/assets")
|
||||||
@ -425,7 +425,7 @@ async def upload_asset(request: web.Request) -> web.Response:
|
|||||||
**asset.model_dump(),
|
**asset.model_dump(),
|
||||||
created_new=False,
|
created_new=False,
|
||||||
)
|
)
|
||||||
return web.json_response(payload_out.model_dump(mode="json"), status=200)
|
return web.json_response(payload_out.model_dump(mode="json", exclude_none=True), status=200)
|
||||||
|
|
||||||
# Fast path: hash exists, create AssetReference without writing anything
|
# Fast path: hash exists, create AssetReference without writing anything
|
||||||
if spec.hash and parsed.provided_hash_exists is True:
|
if spec.hash and parsed.provided_hash_exists is True:
|
||||||
@ -487,7 +487,7 @@ async def upload_asset(request: web.Request) -> web.Response:
|
|||||||
created_new=result.created_new,
|
created_new=result.created_new,
|
||||||
)
|
)
|
||||||
status = 201 if result.created_new else 200
|
status = 201 if result.created_new else 200
|
||||||
return web.json_response(payload_out.model_dump(mode="json"), status=status)
|
return web.json_response(payload_out.model_dump(mode="json", exclude_none=True), status=status)
|
||||||
|
|
||||||
|
|
||||||
@ROUTES.put(f"/api/assets/{{id:{UUID_RE}}}")
|
@ROUTES.put(f"/api/assets/{{id:{UUID_RE}}}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user