test: deflake test-http2-options-max-headers-block-length

The socket can be closed while data is still being written, causing an
`ECONNRESET` error to be emitted on the client. Add a listener for it.

PR-URL: https://github.com/nodejs/node/pull/57959
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
Luigi Pinca authored and GitHub committed 2025-04-24 05:08:08 +00:00
1 parent bd3f27166b
commit 555aeb3aae
1 file changed
+2
@@ -22,6 +22,8 @@ server.listen(0, common.mustCall(() => {
const client = h2.connect(`http://localhost:${server.address().port}`,
options);
client.on('error', () => {});
const req = client.request();
req.on('response', common.mustNotCall());