File tree 2 files changed +2
-10
lines changed
2 files changed +2
-10
lines changed Original file line number Diff line number Diff line change 6
6
const {
7
7
ERR_STREAM_PREMATURE_CLOSE
8
8
} = require ( 'internal/errors' ) . codes ;
9
+ const { once } = require ( 'internal/util' ) ;
9
10
10
11
function noop ( ) { }
11
12
12
13
function isRequest ( stream ) {
13
14
return stream . setHeader && typeof stream . abort === 'function' ;
14
15
}
15
16
16
- function once ( callback ) {
17
- let called = false ;
18
- return function ( err ) {
19
- if ( called ) return ;
20
- called = true ;
21
- callback . call ( this , err ) ;
22
- } ;
23
- }
24
-
25
17
function eos ( stream , opts , callback ) {
26
18
if ( typeof opts === 'function' ) return eos ( stream , null , opts ) ;
27
19
if ( ! opts ) opts = { } ;
Original file line number Diff line number Diff line change @@ -368,7 +368,7 @@ function once(callback) {
368
368
return function ( ...args ) {
369
369
if ( called ) return ;
370
370
called = true ;
371
- callback ( ... args ) ;
371
+ callback . apply ( this , args ) ;
372
372
} ;
373
373
}
374
374
You can’t perform that action at this time.
0 commit comments