@@ -561,11 +561,11 @@ export async function executeWebhook(
561
561
if ( binaryData ?. id ) {
562
562
res . header ( response . headers ) ;
563
563
const stream = await Container . get ( BinaryDataService ) . getAsStream ( binaryData . id ) ;
564
- await pipeline ( stream , res ) ;
564
+ await pipeline ( stream , res , { end : false } ) ;
565
565
responseCallback ( null , { noWebhookResponse : true } ) ;
566
566
} else if ( Buffer . isBuffer ( response . body ) ) {
567
567
res . header ( response . headers ) ;
568
- res . end ( response . body ) ;
568
+ res . write ( response . body ) ;
569
569
responseCallback ( null , { noWebhookResponse : true } ) ;
570
570
} else {
571
571
// TODO: This probably needs some more changes depending on the options on the
@@ -594,6 +594,7 @@ export async function executeWebhook(
594
594
} ) ;
595
595
}
596
596
597
+ res . end ( ) ;
597
598
didSendResponse = true ;
598
599
} )
599
600
. catch ( async ( error ) => {
@@ -793,14 +794,15 @@ export async function executeWebhook(
793
794
res . setHeader ( 'Content-Type' , binaryData . mimeType ) ;
794
795
if ( binaryData . id ) {
795
796
const stream = await Container . get ( BinaryDataService ) . getAsStream ( binaryData . id ) ;
796
- await pipeline ( stream , res ) ;
797
+ await pipeline ( stream , res , { end : false } ) ;
797
798
} else {
798
- res . end ( Buffer . from ( binaryData . data , BINARY_ENCODING ) ) ;
799
+ res . write ( Buffer . from ( binaryData . data , BINARY_ENCODING ) ) ;
799
800
}
800
801
801
802
responseCallback ( null , {
802
803
noWebhookResponse : true ,
803
804
} ) ;
805
+ res . end ( ) ;
804
806
}
805
807
} else if ( responseData === 'noData' ) {
806
808
// Return without data
0 commit comments