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 @@ -7,20 +7,12 @@ const {
7
7
ERR_INVALID_ARG_TYPE ,
8
8
ERR_STREAM_PREMATURE_CLOSE
9
9
} = require ( 'internal/errors' ) . codes ;
10
+ const { once } = require ( 'internal/util' ) ;
10
11
11
12
function isRequest ( stream ) {
12
13
return stream . setHeader && typeof stream . abort === 'function' ;
13
14
}
14
15
15
- function once ( callback ) {
16
- let called = false ;
17
- return function ( err ) {
18
- if ( called ) return ;
19
- called = true ;
20
- callback . call ( this , err ) ;
21
- } ;
22
- }
23
-
24
16
function eos ( stream , opts , callback ) {
25
17
if ( arguments . length === 2 ) {
26
18
callback = opts ;
Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ function once(callback) {
375
375
return function ( ...args ) {
376
376
if ( called ) return ;
377
377
called = true ;
378
- callback ( ... args ) ;
378
+ callback . apply ( this , args ) ;
379
379
} ;
380
380
}
381
381
You can’t perform that action at this time.
0 commit comments