release: v1.17.12 — 修复 CI 在新版 FastAPI 上路由注册失败

DELETE /api/v1/strategies/{id} 原用 status_code=204,较新 FastAPI/Starlette
在路由注册阶段(add_api_route)就抛 AssertionError: Status code 204 must
not have a response body,导致 CI ubuntu 矩阵 21 个 web 测试因 fixture
导入 router 连带 ERROR。改为返回 200 + {"deleted": id} 确认体。
This commit is contained in:
Justin Gu
2026-07-04 20:50:07 +08:00
parent 05dc9a74af
commit ee628c1b34
4 changed files with 21 additions and 6 deletions
+3 -2
View File
@@ -214,9 +214,10 @@ def test_router_create_then_list_get_delete(client: TestClient):
assert resp.status_code == 200
assert resp.json()["snapshot"]["total_return"] == pytest.approx(0.35)
# 4. 删除
# 4. 删除(返回 200 + 确认体,非 204,见路由注释)
resp = client.delete(f"/api/v1/strategies/{sid}")
assert resp.status_code == 204
assert resp.status_code == 200
assert resp.json()["deleted"] == sid
# 5. 列表为空
assert client.get("/api/v1/strategies").json()["count"] == 0