summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-server-rst-stream.js
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2017-10-02 21:56:53 -0400
committerMatteo Collina <hello@matteocollina.com>2017-10-06 14:04:22 -0700
commit2da7d9b8207d9c35d199734da75fa2bb15f326b6 (patch)
tree9aa1ed51d29bc3d9241539e9ded4d0e4da951970 /test/parallel/test-http2-server-rst-stream.js
parent4f339b54e9cd8a2cb69b41d87832ad8ca3a6b5e2 (diff)
downloadandroid-node-v8-2da7d9b8207d9c35d199734da75fa2bb15f326b6.tar.gz
android-node-v8-2da7d9b8207d9c35d199734da75fa2bb15f326b6.tar.bz2
android-node-v8-2da7d9b8207d9c35d199734da75fa2bb15f326b6.zip
http2: near full http1 compatibility, add tests
Extensive re-work of http1 compatibility layer based on tests in express, on-finished and finalhandler. Fix handling of HEAD method to match http1. Adjust write, end, etc. to call writeHead as in http1 and as expected by user-land modules. Add socket proxy that instead uses the Http2Stream for the vast majority of socket interactions. Add and change tests to closer represent http1 behaviour. Refs: https://github.com/nodejs/node/pull/15633 Refs: https://github.com/expressjs/express/tree/master/test Refs: https://github.com/jshttp/on-finished/blob/master/test/test.js Refs: https://github.com/pillarjs/finalhandler/blob/master/test/test.js PR-URL: https://github.com/nodejs/node/pull/15702 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-http2-server-rst-stream.js')
-rw-r--r--test/parallel/test-http2-server-rst-stream.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/parallel/test-http2-server-rst-stream.js b/test/parallel/test-http2-server-rst-stream.js
index edaaed35c6..b92217dc99 100644
--- a/test/parallel/test-http2-server-rst-stream.js
+++ b/test/parallel/test-http2-server-rst-stream.js
@@ -17,7 +17,7 @@ const {
NGHTTP2_INTERNAL_ERROR
} = http2.constants;
-const errCheck = common.expectsError({ code: 'ERR_HTTP2_STREAM_ERROR' }, 8);
+const errCheck = common.expectsError({ code: 'ERR_HTTP2_STREAM_ERROR' }, 6);
function checkRstCode(rstMethod, expectRstCode) {
const server = http2.createServer();
@@ -32,8 +32,11 @@ function checkRstCode(rstMethod, expectRstCode) {
else
stream[rstMethod]();
- if (expectRstCode > NGHTTP2_NO_ERROR) {
+ if (expectRstCode !== NGHTTP2_NO_ERROR &&
+ expectRstCode !== NGHTTP2_CANCEL) {
stream.on('error', common.mustCall(errCheck));
+ } else {
+ stream.on('error', common.mustNotCall());
}
});
@@ -58,8 +61,11 @@ function checkRstCode(rstMethod, expectRstCode) {
req.on('aborted', common.mustCall());
req.on('end', common.mustCall());
- if (expectRstCode > NGHTTP2_NO_ERROR) {
+ if (expectRstCode !== NGHTTP2_NO_ERROR &&
+ expectRstCode !== NGHTTP2_CANCEL) {
req.on('error', common.mustCall(errCheck));
+ } else {
+ req.on('error', common.mustNotCall());
}
}));