- Version: 10.1.0
- Platform: Windows Server 2008R2 64
- Subsystem: any browser any OS
If push some assets which will not be used with browser - stream closes on the second request
Page requires only <script src="script.js"></script>, but if to push something that is not using on the page - the next page refresh will close the http2 stream
constpushAsset=(stream,file)=>{constfilePath=path.resolve(file.filePath);stream.pushStream({[HTTP2_HEADER_PATH]: file.path},(err,pushStream)=>{pushStream.respondWithFile(filePath,file.headers,{onError: (err)=>{respondToStreamError(err,stream);}});});};constcssFile={path: '/style.css',filePath: './style.css',headers: {'content-type': 'text/css'}};constcssFile1={path: '/style1.css',filePath: './style1.css',headers: {'content-type': 'text/css'}};constjsFile={path: '/script.js',filePath: './script.js',headers: {'content-type': 'application/javascript'}};pushAsset(stream,jsFile);pushAsset(stream,cssFile);//<-- unusedpushAsset(stream,cssFile1);//<-- unusedThe error:
events.js:167
throw er; // Unhandled 'error' event
^
Error [ERR_HTTP2_STREAM_ERROR]: Stream closed with error code NGHTTP2_REFUSED_STREAM
at ServerHttp2Stream._destroy (internal/http2/core.js:1871:13)
at ServerHttp2Stream.destroy (internal/streams/destroy.js:32:8)
at ServerHttp2Stream.[maybe-destroy] (internal/http2/core.js:1887:12)
at Http2Stream.onStreamClose [as onstreamclose] (internal/http2/core.js:346:26)
Emitted 'error' event at:
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
Declaration of extra assets should not crush the tream
If push some assets which will not be used with browser - stream closes on the second request
Page requires only
<script src="script.js"></script>, but if to push something that is not using on the page - the next page refresh will close the http2 streamThe error:
Declaration of extra assets should not crush the tream