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