File tree Expand file tree Collapse file tree
components/nodes/agentflow/Start
server/src/services/webhook Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -352,7 +352,12 @@ class Start_Agentflow implements INode {
352352
353353 if ( startInputType === 'webhookTrigger' ) {
354354 inputData . webhook = input
355- let webhookOutput = input
355+ let webhookOutput : string | Record < string , any > = input
356+ try {
357+ webhookOutput = typeof input === 'string' ? JSON . parse ( input ) : input
358+ } catch ( _ ) {
359+ /* keep as-is */
360+ }
356361 if ( options . agentflowRuntime ?. webhook && Object . keys ( options . agentflowRuntime . webhook ) . length ) {
357362 webhookOutput = options . agentflowRuntime . webhook
358363 }
Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ const validateWebhookChatflow = async (
3434
3535 // Content-Type validation (startsWith handles "application/json; charset=utf-8" variants)
3636 const webhookContentType = startNode ?. data ?. inputs ?. webhookContentType
37- if ( webhookContentType && ! headers ?. [ 'content-type' ] ?. startsWith ( webhookContentType ) ) {
37+ const incomingContentType = ( headers ?. [ 'content-type' ] ?? '' ) . toLowerCase ( )
38+ if ( webhookContentType && ! incomingContentType . startsWith ( webhookContentType ) ) {
3839 throw new InternalFlowiseError (
3940 StatusCodes . UNSUPPORTED_MEDIA_TYPE ,
4041 `Content-Type ${ headers ?. [ 'content-type' ] } not allowed. Expected ${ webhookContentType } `
@@ -44,7 +45,7 @@ const validateWebhookChatflow = async (
4445 // Required header validation
4546 const rawHeaderParams = startNode ?. data ?. inputs ?. webhookHeaderParams
4647 const webhookHeaderParams : Array < { name : string ; required : boolean } > = Array . isArray ( rawHeaderParams ) ? rawHeaderParams : [ ]
47- const missingHeaders = webhookHeaderParams . filter ( ( p ) => p . required && headers ?. [ p . name ] == null ) . map ( ( p ) => p . name )
48+ const missingHeaders = webhookHeaderParams . filter ( ( p ) => p . required && headers ?. [ p . name . toLowerCase ( ) ] == null ) . map ( ( p ) => p . name )
4849 if ( missingHeaders . length > 0 ) {
4950 throw new InternalFlowiseError ( StatusCodes . BAD_REQUEST , `Missing required headers: ${ missingHeaders . join ( ', ' ) } ` )
5051 }
You can’t perform that action at this time.
0 commit comments