summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-compat-serverrequest-settimeout.js
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2017-09-19 11:22:35 -0400
committerMatteo Collina <hello@matteocollina.com>2017-09-21 09:21:53 +0200
commitbc23681aa2fc49df6e7cd134dfa0a782d8a471a0 (patch)
treee72eec778e84a0a6df3cbb978686aafce75ecd5b /test/parallel/test-http2-compat-serverrequest-settimeout.js
parente5c290bed9775bdddd74650995f3358373af8097 (diff)
downloadandroid-node-v8-bc23681aa2fc49df6e7cd134dfa0a782d8a471a0.tar.gz
android-node-v8-bc23681aa2fc49df6e7cd134dfa0a782d8a471a0.tar.bz2
android-node-v8-bc23681aa2fc49df6e7cd134dfa0a782d8a471a0.zip
http2: small fixes to compatibility layer
Expand argument validation through compat API, adjust behaviour of response.end to not throw if stream already closed to match http1, adjust behaviour of writeContinue to not throw if stream already closed and other very small tweaks. Add tests for added and fixed behaviour. Add tests for edge case behaviours of setTimeout, createPushResponse, destroy, end and trailers. PR-URL: https://github.com/nodejs/node/pull/15473 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Diffstat (limited to 'test/parallel/test-http2-compat-serverrequest-settimeout.js')
-rw-r--r--test/parallel/test-http2-compat-serverrequest-settimeout.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/parallel/test-http2-compat-serverrequest-settimeout.js b/test/parallel/test-http2-compat-serverrequest-settimeout.js
index 6e02fe0cff..7cdae697cc 100644
--- a/test/parallel/test-http2-compat-serverrequest-settimeout.js
+++ b/test/parallel/test-http2-compat-serverrequest-settimeout.js
@@ -4,13 +4,25 @@
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
+const assert = require('assert');
const http2 = require('http2');
+const msecs = common.platformTimeout(1);
const server = http2.createServer();
server.on('request', (req, res) => {
- req.setTimeout(common.platformTimeout(1), common.mustCall(() => {
+ req.setTimeout(msecs, common.mustCall(() => {
res.end();
+ req.setTimeout(msecs, common.mustNotCall());
+ }));
+ res.on('finish', common.mustCall(() => {
+ req.setTimeout(msecs, common.mustNotCall());
+ process.nextTick(() => {
+ assert.doesNotThrow(
+ () => req.setTimeout(msecs, common.mustNotCall())
+ );
+ server.close();
+ });
}));
});
@@ -24,7 +36,6 @@ server.listen(0, common.mustCall(() => {
':authority': `localhost:${port}`
});
req.on('end', common.mustCall(() => {
- server.close();
client.destroy();
}));
req.resume();