生产把应用挂在域名根、路由带 /api/v1 前缀,request.base_url 里没有前缀, 拼出来的地址少了这一段;本地被 Vite 的代理掩盖了。改成从 base_url 截站点根、 前缀一律取 settings.api_prefix,并补一条断言把这个差异钉住。
This commit is contained in:
@@ -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']}")
|
||||
|
||||
Reference in New Issue
Block a user