diff options
author | Anatoli Papirovski <apapirovski@mac.com> | 2017-10-02 21:56:53 -0400 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2017-10-06 14:04:22 -0700 |
commit | 2da7d9b8207d9c35d199734da75fa2bb15f326b6 (patch) | |
tree | 9aa1ed51d29bc3d9241539e9ded4d0e4da951970 /test/parallel/test-http2-compat-serverresponse-flushheaders.js | |
parent | 4f339b54e9cd8a2cb69b41d87832ad8ca3a6b5e2 (diff) | |
download | android-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-compat-serverresponse-flushheaders.js')
-rw-r--r-- | test/parallel/test-http2-compat-serverresponse-flushheaders.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/parallel/test-http2-compat-serverresponse-flushheaders.js b/test/parallel/test-http2-compat-serverresponse-flushheaders.js index 48bf4dd2d4..68d4789f69 100644 --- a/test/parallel/test-http2-compat-serverresponse-flushheaders.js +++ b/test/parallel/test-http2-compat-serverresponse-flushheaders.js @@ -15,18 +15,23 @@ server.listen(0, common.mustCall(function() { const port = server.address().port; server.once('request', common.mustCall(function(request, response) { assert.strictEqual(response.headersSent, false); + assert.strictEqual(response._header, false); // alias for headersSent response.flushHeaders(); assert.strictEqual(response.headersSent, true); + assert.strictEqual(response._header, true); response.flushHeaders(); // Idempotent common.expectsError(() => { response.writeHead(400, { 'foo-bar': 'abc123' }); }, { - code: 'ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND' + code: 'ERR_HTTP2_HEADERS_SENT' }); response.on('finish', common.mustCall(function() { server.close(); + process.nextTick(() => { + response.flushHeaders(); // Idempotent + }); })); serverResponse = response; })); |