From a2c42b06a85b49c7ec0db6167d1c78dbd7663ae5 Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Sun, 26 Apr 2020 09:39:18 +0530 Subject: [PATCH] http2: add type checks for Http2ServerResponse.end Refs: https://github.com/nodejs/node/issues/29829 PR-URL: https://github.com/nodejs/node/pull/33146 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- test/parallel/test-http-outgoing-end-types.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/parallel/test-http-outgoing-end-types.js diff --git a/test/parallel/test-http-outgoing-end-types.js b/test/parallel/test-http-outgoing-end-types.js new file mode 100644 index 00000000000000..20b443bff2c1f5 --- /dev/null +++ b/test/parallel/test-http-outgoing-end-types.js @@ -0,0 +1,18 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const http = require('http'); + +const httpServer = http.createServer(common.mustCall(function(req, res) { + httpServer.close(); + assert.throws(() => { + res.end(['Throws.']); + }, { + code: 'ERR_INVALID_ARG_TYPE' + }); + res.end(); +})); + +httpServer.listen(0, common.mustCall(function() { + http.get({ port: this.address().port }); +}));