I've found an interesting issue. When using the h2 protocol, res.finished always returns false. Using http/1.1 as a protocol, this does work correctly.
Some sample code to reproduce:
var options = {
spdy: {
protocols: ['h2'],
// Replace with this to see correct value:
// protocols: ['http/1.1'],
},
};
var server = spdy.createServer(options, function(req, res) {
res.writeHead(200);
res.end('hello world!');
console.log('res finished:', res.finished);
});
server.listen(8080);
In this example, I would expect that the console outputs: res finished: true.
I wanted to try spdy with the sockjs-node package, but that doesn't work because of this issue. Took me a few hours to discover the root cause :).
I've found an interesting issue. When using the
h2
protocol,res.finished
always returnsfalse
. Usinghttp/1.1
as a protocol, this does work correctly.Some sample code to reproduce:
In this example, I would expect that the console outputs:
res finished: true
.I wanted to try spdy with the
sockjs-node
package, but that doesn't work because of this issue. Took me a few hours to discover the root cause :).Also see Node.js documentation about this.