Skip to content

Commit ffbaa0b

Browse files
committed
disconnect_connection_api 関数の URL 型を HttpUrl から str に変更し、簡易バリデーションを追加する
1 parent 0ad2f1c commit ffbaa0b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import httpx
2-
from pydantic import HttpUrl
32

43

5-
def disconnect_connection_api(url: HttpUrl, channel_id: str, connection_id: str) -> httpx.Response:
4+
def disconnect_connection_api(url: str, channel_id: str, connection_id: str) -> httpx.Response:
5+
# URL の簡易バリデーション
6+
if not url or not (url.startswith("http://") or url.startswith("https://")):
7+
raise ValueError(f"Invalid URL: {url}")
8+
69
headers = {
710
"Content-Type": "application/json",
811
"x-sora-target": "Sora_20151104.DisconnectConnection",
@@ -11,4 +14,4 @@ def disconnect_connection_api(url: HttpUrl, channel_id: str, connection_id: str)
1114
"channel_id": channel_id,
1215
"connection_id": connection_id,
1316
}
14-
return httpx.post(str(url), headers=headers, json=body, follow_redirects=True)
17+
return httpx.post(url, headers=headers, json=body, follow_redirects=True)

0 commit comments

Comments
 (0)