@@ -117,6 +117,23 @@ describe('createRemoteHandlers', () => {
117117 } ) ;
118118 expect ( result ) . toEqual ( { updated : true } ) ;
119119 } ) ;
120+
121+ it ( 'treats a bare body (no path/body key) as the request body, like POST' , async ( ) => {
122+ // A no-path endpoint's generated wrapper passes the body directly (e.g. patchUsersCommand({...})).
123+ // Regression: handlePatchCommand used to only forward input.body, silently dropping a bare body.
124+ const client = createMockClient ( ) ;
125+ client . PATCH . mockResolvedValue ( {
126+ data : { updated : true } ,
127+ error : undefined ,
128+ response : { ok : true , status : 200 } ,
129+ } ) ;
130+ const { handlePatchCommand } = createRemoteHandlers ( client as any ) ;
131+ const result = await handlePatchCommand ( '/users' , { firstName : 'Tam' , lastName : 'M' } ) ;
132+ expect ( client . PATCH ) . toHaveBeenCalledWith ( '/users' , {
133+ body : { firstName : 'Tam' , lastName : 'M' } ,
134+ } ) ;
135+ expect ( result ) . toEqual ( { updated : true } ) ;
136+ } ) ;
120137 } ) ;
121138
122139 describe ( 'handlePutCommand' , ( ) => {
@@ -138,6 +155,21 @@ describe('createRemoteHandlers', () => {
138155 } ) ;
139156 expect ( result ) . toEqual ( { id : 1 , name : 'Replaced' } ) ;
140157 } ) ;
158+
159+ it ( 'treats a bare body (no path/body key) as the request body, like POST' , async ( ) => {
160+ const client = createMockClient ( ) ;
161+ client . PUT . mockResolvedValue ( {
162+ data : { replaced : true } ,
163+ error : undefined ,
164+ response : { ok : true , status : 200 } ,
165+ } ) ;
166+ const { handlePutCommand } = createRemoteHandlers ( client as any ) ;
167+ const result = await handlePutCommand ( '/settings' , { theme : 'dark' } ) ;
168+ expect ( client . PUT ) . toHaveBeenCalledWith ( '/settings' , {
169+ body : { theme : 'dark' } ,
170+ } ) ;
171+ expect ( result ) . toEqual ( { replaced : true } ) ;
172+ } ) ;
141173 } ) ;
142174
143175 describe ( 'handleDeleteCommand' , ( ) => {
0 commit comments