Skip to content

Commit 9759fa0

Browse files
committed
fix(sdk): treat null as no input for consistency with Python SDK
1 parent d47b35a commit 9759fa0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/ts-sdk/src/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ describe('SimStudioClient', () => {
608608
expect(requestBody).not.toHaveProperty('input') // Should not wrap in input field
609609
})
610610

611-
it('should handle null input by wrapping in input field', async () => {
611+
it('should handle null input as no input (empty body)', async () => {
612612
const fetch = await import('node-fetch')
613613
const mockResponse = {
614614
ok: true,
@@ -629,8 +629,8 @@ describe('SimStudioClient', () => {
629629
const calls = vi.mocked(fetch.default).mock.calls
630630
const requestBody = JSON.parse(calls[0][1]?.body as string)
631631

632-
// null wraps in input field
633-
expect(requestBody).toHaveProperty('input', null)
632+
// null treated as "no input" - sends empty body (consistent with Python SDK)
633+
expect(requestBody).toEqual({})
634634
})
635635
})
636636
})

packages/ts-sdk/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class SimStudioClient {
193193
}
194194

195195
let jsonBody: any = {}
196-
if (input !== undefined) {
196+
if (input !== undefined && input !== null) {
197197
if (typeof input === 'object' && input !== null && !Array.isArray(input)) {
198198
jsonBody = { ...input }
199199
} else {

0 commit comments

Comments
 (0)