You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 6, 2018. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 6, 2018. It is now read-only.
http2 client: end event not emitted if no data listener registered #99
The http2 client will not emit end, given no data listener is registered, even if the server ends the response.
The following code calls req.on('end') just in the case req.on('data') is registered.
'use strict';require('../common');constassert=require('assert');consthttp2=require('http2');consttestResBody='other stuff!\n';constserver=http2.createServer((req,res)=>{res.writeHead(200,{'Content-Type': 'text/plain'});res.end(testResBody);});server.listen(0,function(){constclient=http2.connect(`http://localhost:${this.address().port}`);constheaders={':path': '/'};constreq=client.request(headers)req.setEncoding('utf8');// XXX: remove this and ` req.on('end')` is never called letdata='';req.on('data',(d)=>data+=d);req.on('response',(headers)=>{assert.ok('date'inheaders,'Response headers contain a date.');});req.on('end',()=>{server.close();process.exit();});req.end();});
This is expected, as 'end' does not trigger the stream to flow. You should manually call resume(), add a on('data') or on('readable') event. This is part of streams, not http2.
On Mon, May 15, 2017 at 1:34 PM, Matteo Collina ***@***.***> wrote:
This is expected, as 'end' does not trigger the stream to flow. You
should manually call resume(), add a on('data') or on('readable') event.
This is part of streams, not http2.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#99 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AASMtvJ0DAoRy6TXkc-whN5Cy59ZZDXhks5r6DhfgaJpZM4NXPfv>
.
Activity
mcollina commentedon May 15, 2017
This is expected, as
'end'does not trigger the stream to flow. You should manually callresume(), add aon('data')oron('readable')event. This is part of streams, not http2.robertkowalski commentedon May 15, 2017
mcollina commentedon May 15, 2017
Have a look at:
http2/test/parallel/test-http-date-header.js
Line 53 in 98e54b0
robertkowalski commentedon May 15, 2017
doh!
man thank you, I got a bit rusty!