Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve HTTP2 documentation. #16366

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ req.on('response', (headers, flags) => {
}
});

let data = []
req.on('data', (d) => data.push(d));
req.setEncoding('utf8');
let rawData = '';
req.on('data', (chunk) => { rawData += chunk; });
req.on('end', () => {
console.log();
Copy link
Member

@apapirovski apapirovski Oct 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we remove this extra console.log — I think it might confuse people as to why it's there.

(The rest is good to go, I think.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to have a newline between the headers and the body, since that will make it clearer which is which. Would it be better to put the newline as part of the next line, e.g. console.log("\n" + ...)?

console.log(Buffer.concat(data).toString('utf8'));
console.log(rawData);
client.destroy()
});
req.end();
Expand Down