File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
packages/platform-express/adapters Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ import type { Server } from 'http';
30
30
import * as http from 'http' ;
31
31
import * as https from 'https' ;
32
32
import { pathToRegexp } from 'path-to-regexp' ;
33
- import { Duplex , pipeline } from 'stream' ;
33
+ import { Duplex , Writable } from 'stream' ;
34
34
import { NestExpressBodyParserOptions } from '../interfaces/nest-express-body-parser-options.interface' ;
35
35
import { NestExpressBodyParserType } from '../interfaces/nest-express-body-parser.interface' ;
36
36
import { ServeStaticOptions } from '../interfaces/serve-static-options.interface' ;
@@ -86,17 +86,13 @@ export class ExpressAdapter extends AbstractHttpAdapter<
86
86
) {
87
87
response . setHeader ( 'Content-Length' , streamHeaders . length ) ;
88
88
}
89
- return pipeline (
90
- body . getStream ( ) . once ( 'error' , ( err : Error ) => {
91
- body . errorHandler ( err , response ) ;
92
- } ) ,
93
- response ,
94
- ( err : any ) => {
95
- if ( err ) {
96
- body . errorLogger ( err ) ;
97
- }
98
- } ,
99
- ) ;
89
+ const stream = body . getStream ( ) ;
90
+ stream . once ( 'error' , err => {
91
+ body . errorHandler ( err , response ) ;
92
+ } ) ;
93
+ return stream
94
+ . pipe < Writable > ( response )
95
+ . on ( 'error' , ( err : Error ) => body . errorLogger ( err ) ) ;
100
96
}
101
97
const responseContentType = response . getHeader ( 'Content-Type' ) ;
102
98
if (
You can’t perform that action at this time.
0 commit comments