feat(client): support file upload requests

This commit is contained in:
stainless-app[bot] 2025-07-31 02:49:52 +00:00
parent a4212485db
commit 34ccc7f7d7
2 changed files with 8 additions and 5 deletions

View file

@ -532,7 +532,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
is_body_allowed = options.method.lower() != "get"
if is_body_allowed:
kwargs["json"] = json_data if is_given(json_data) else None
if isinstance(json_data, bytes):
kwargs["content"] = json_data
else:
kwargs["json"] = json_data if is_given(json_data) else None
kwargs["files"] = files
else:
headers.pop("Content-Type", None)