diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 36e36ec940975f..abd9c8f417b81b 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -2152,12 +2152,16 @@ class Http2Stream extends Duplex { // By using setImmediate we allow pushStreams to make it through // before the stream is officially closed. This prevents a bug // in most browsers where those pushStreams would be rejected. - setImmediate(this.close.bind(this)); + setImmediate(callStreamClose, this); } } } } +function callStreamClose(stream) { + stream.close(); +} + function processHeaders(oldHeaders) { assertIsObject(oldHeaders, 'headers'); const headers = ObjectCreate(null);