diff options
author | Robert Nagy <ronagy@icloud.com> | 2018-11-13 23:33:14 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-12 20:32:35 +0100 |
commit | 90fdf1b0d3811f5e1163d81a403b7e7071d279e5 (patch) | |
tree | 62b011ebb7dce8dc0f4719f8de7950a6c297ab5a /test/parallel/test-http2-compat-serverresponse-end.js | |
parent | 2a7da11ed81a833bf070e706441a558c4d7b957c (diff) | |
download | android-node-v8-90fdf1b0d3811f5e1163d81a403b7e7071d279e5.tar.gz android-node-v8-90fdf1b0d3811f5e1163d81a403b7e7071d279e5.tar.bz2 android-node-v8-90fdf1b0d3811f5e1163d81a403b7e7071d279e5.zip |
http2: `Http2ServerResponse.end()` should always return self
PR-URL: https://github.com/nodejs/node/pull/24346
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-http2-compat-serverresponse-end.js')
-rw-r--r-- | test/parallel/test-http2-compat-serverresponse-end.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/parallel/test-http2-compat-serverresponse-end.js b/test/parallel/test-http2-compat-serverresponse-end.js index d7aaebca3d..e7972c2fe0 100644 --- a/test/parallel/test-http2-compat-serverresponse-end.js +++ b/test/parallel/test-http2-compat-serverresponse-end.js @@ -61,6 +61,34 @@ const { } { + // Http2ServerResponse.end should return self after end + const server = createServer(mustCall((request, response) => { + strictEqual(response, response.end()); + strictEqual(response, response.end()); + server.close(); + })); + server.listen(0, mustCall(() => { + const { port } = server.address(); + const url = `http://localhost:${port}`; + const client = connect(url, mustCall(() => { + const headers = { + ':path': '/', + ':method': 'GET', + ':scheme': 'http', + ':authority': `localhost:${port}` + }; + const request = client.request(headers); + request.setEncoding('utf8'); + request.on('end', mustCall(() => { + client.close(); + })); + request.end(); + request.resume(); + })); + })); +} + +{ // Http2ServerResponse.end can omit encoding arg, sets it to utf-8 const server = createServer(mustCall((request, response) => { response.end('test\uD83D\uDE00', mustCall(() => { |