diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 4a4ab28e3e4af6..6dc4ba953e52c4 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -2155,12 +2155,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 = Object.create(null);