Skip to content
This repository was archived by the owner on Jul 6, 2018. It is now read-only.

Commit 44cc0b8

Browse files
committed
Workaround for out-of-order bug
1 parent 7f8a5eb commit 44cc0b8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

test/parallel/test-http2-compat-Http2ServerResponse-createPushRequest.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ function requestListener(request, response) {
2727
pushRequest.push(common.mustCall(function(error, pushResponse) {
2828
assert.strictEqual(error, null);
2929
assert.ok(isEven(pushResponse.stream.id));
30-
pushResponse.end('This is a server-initiated response');
3130
response.end('This is a client-initiated response');
32-
resolve();
31+
32+
// TODO(sebdeckers) Workaround with server-side timeout to ensure data
33+
// is read by client before stream closes.
34+
pushResponse.write('This is a server-initiated response');
35+
setTimeout(function () {
36+
pushResponse.end();
37+
resolve();
38+
}, 100);
3339
}));
3440
});
3541
}
@@ -56,9 +62,11 @@ function clientRequest(client, socket) {
5662
data.toString(),
5763
'This is a server-initiated response'
5864
);
65+
resolve();
5966
}));
6067

61-
pushStream.on('streamClosed', resolve);
68+
// TODO(sebdeckers) Figure out why streamClosed fires before data.
69+
// pushStream.on('streamClosed', resolve);
6270
}
6371
requestStream.session.on('stream', common.mustCall(onStream));
6472

0 commit comments

Comments
 (0)