Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit bbb3848

Browse files
feat: Check if url arg is an HTTP URL
1 parent 3fd4638 commit bbb3848

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

supabase_functions/_async/functions_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from httpx import HTTPError, Response
44

55
from ..errors import FunctionsHttpError, FunctionsRelayError
6-
from ..utils import AsyncClient
6+
from ..utils import AsyncClient, is_valid_str_arg, is_https_url
77
from ..version import __version__
88

99

@@ -16,6 +16,8 @@ def __init__(
1616
verify: bool = True,
1717
proxy: Optional[str] = None,
1818
):
19+
if not is_https_url(url):
20+
ValueError("url must be a valid HTTP URL string")
1921
self.url = url
2022
self.headers = {
2123
"User-Agent": f"supabase-py/functions-py v{__version__}",
@@ -25,7 +27,7 @@ def __init__(
2527
base_url=self.url,
2628
headers=self.headers,
2729
verify=bool(verify),
28-
timeout=timeout,
30+
timeout=int(abs(timeout)),
2931
proxy=proxy,
3032
follow_redirects=True,
3133
http2=True,
@@ -73,6 +75,8 @@ async def invoke(
7375
`body`: the body of the request
7476
`responseType`: how the response should be parsed. The default is `json`
7577
"""
78+
if not is_valid_str_arg(function_name):
79+
raise ValueError("function_name must a valid string value.")
7680
headers = self.headers
7781
body = None
7882
response_type = "text/plain"

0 commit comments

Comments
 (0)