@@ -217,6 +217,24 @@ test('claude35 malformed payload produces reasonable values', async (t) => {
217217 assert . equal ( cmd . temperature , undefined )
218218} )
219219
220+ test ( 'claude35 skips a message that is null in `body.messages`' , async ( t ) => {
221+ const malformedPayload = structuredClone ( claude35 )
222+ malformedPayload . body . messages = [ { role : 'user' , content : 'who are you' } , null ]
223+ t . nr . updatePayload ( malformedPayload )
224+ const cmd = new BedrockCommand ( t . nr . input )
225+ assert . equal ( cmd . isClaude3 ( ) , true )
226+ assert . deepEqual ( cmd . prompt , [ { role : 'user' , content : 'who are you' } ] )
227+ } )
228+
229+ test ( 'claude35 handles defaulting prompt to empty array when `body.messages` is null' , async ( t ) => {
230+ const malformedPayload = structuredClone ( claude35 )
231+ malformedPayload . body . messages = null
232+ t . nr . updatePayload ( malformedPayload )
233+ const cmd = new BedrockCommand ( t . nr . input )
234+ assert . equal ( cmd . isClaude3 ( ) , true )
235+ assert . deepEqual ( cmd . prompt , [ ] )
236+ } )
237+
220238test ( 'claude35 minimal command works' , async ( t ) => {
221239 t . nr . updatePayload ( structuredClone ( claude35 ) )
222240 const cmd = new BedrockCommand ( t . nr . input )
0 commit comments