fix(integrations): 回调地址漏了 /api/v1,生产上打过去是 405
CI / backend (push) Canceled after 0s

生产把应用挂在域名根、路由带 /api/v1 前缀,request.base_url 里没有前缀,
拼出来的地址少了这一段;本地被 Vite 的代理掩盖了。改成从 base_url 截站点根、
前缀一律取 settings.api_prefix,并补一条断言把这个差异钉住。
This commit is contained in:
Steven
2026-11-05 22:06:37 +08:00
parent 90b99f8253
commit c194609193
3 changed files with 17 additions and 2 deletions
+8
View File
@@ -197,3 +197,11 @@ async def test_member_cannot_manage_channels(client: AsyncClient) -> None:
)
assert resp.status_code == 403
assert resp.json()["code"] in (3004, 3003)
async def test_webhook_url_carries_api_prefix(client: AsyncClient) -> None:
"""回调地址必须带 /api/v1:生产上应用挂在域名根,漏了前缀就是 405。"""
user = await login(client)
ws = await create_workspace(client, user, "微信地址")
channel = await _channel(client, user, ws)
assert channel["webhook_url"].endswith(f"/api/v1/integrations/clawbot/{channel['token']}")