Skip to content

Commit d1ba63a

Browse files
fix: body types other than JSON are improperly handled when invoking a function (#186)
1 parent 72edff0 commit d1ba63a

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
run: make run_tests
3434

3535
- name: Upload coverage to Coveralls
36+
if: ${{ matrix.python-version }} == "3.12"
3637
uses: coverallsapp/github-action@v2
3738
with:
3839
github-token: ${{ secrets.GITHUB_TOKEN }}

supabase_functions/_async/functions_client.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ async def _request(
4747
headers: Optional[Dict[str, str]] = None,
4848
json: Optional[Dict[Any, Any]] = None,
4949
) -> Response:
50-
response = await self._client.request(method, url, json=json, headers=headers)
50+
51+
user_data = {"data": json} if isinstance(json, str) else {"json": json}
52+
response = await self._client.request(method, url, **user_data, headers=headers)
53+
5154
try:
5255
response.raise_for_status()
5356
except HTTPError as exc:

supabase_functions/_sync/functions_client.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ def _request(
4747
headers: Optional[Dict[str, str]] = None,
4848
json: Optional[Dict[Any, Any]] = None,
4949
) -> Response:
50-
response = self._client.request(method, url, json=json, headers=headers)
50+
51+
user_data = {"data": json} if isinstance(json, str) else {"json": json}
52+
response = self._client.request(method, url, **user_data, headers=headers)
53+
5154
try:
5255
response.raise_for_status()
5356
except HTTPError as exc:

0 commit comments

Comments
 (0)