mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-05-20 09:32:42 +00:00
fix: send empty JSON body in session.create()
The OpenCode server's POST /session endpoint requires a JSON request
body (Content-Type: application/json), even when no parameters are
provided. Without a body, the server returns 400 'Malformed JSON in
request body'.
Both the sync and async create() methods now send body={} so that the
SDK serializes an empty JSON object, matching what the server expects.
This commit is contained in:
parent
817f1a0816
commit
f0dfcbc9f9
1 changed files with 2 additions and 0 deletions
|
|
@ -63,6 +63,7 @@ class SessionResource(SyncAPIResource):
|
|||
"""Create a new session"""
|
||||
return self._post(
|
||||
"/session",
|
||||
body={},
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
|
|
@ -508,6 +509,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
"""Create a new session"""
|
||||
return await self._post(
|
||||
"/session",
|
||||
body={},
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue