diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a0d3a4e..2f47ab11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,7 @@ jobs: node-version: - 14.x - 16.x + - 18.x runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v2 diff --git a/lib/request.js b/lib/request.js index a4c54d0e..60f15fed 100644 --- a/lib/request.js +++ b/lib/request.js @@ -2,7 +2,6 @@ 'use strict'; -const { emitWarning } = require('node:process'); var url = require('url'); var sprintf = require('util').format; @@ -837,25 +836,6 @@ function patch(Request) { return self._connectionState; }; - /** - * Returns true when connection state is "close" - * - * @private - * @memberof Request - * @instance - * @function closed - * @returns {Boolean} is closed - */ - Request.prototype.closed = function closed() { - emitWarning( - 'restify req.closed is deprecated, will be removed on Restify 10', - 'RestifyDeprecationWarning', - 'RestifyDEPReqClosed' - ); - var self = this; - return self.connectionState() === 'close'; - }; - /** * Returns the route object to which the current request was matched to. * diff --git a/lib/server.js b/lib/server.js index 3276e030..0707aa73 100644 --- a/lib/server.js +++ b/lib/server.js @@ -257,7 +257,7 @@ function Server(options) { if (addr) { str += - addr.family === 'IPv6' + addr.family === 'IPv6' || addr.family === 6 ? '[' + addr.address + ']' : addr.address; str += ':'; diff --git a/test/request.test.js b/test/request.test.js index a2d216fb..44764505 100644 --- a/test/request.test.js +++ b/test/request.test.js @@ -275,27 +275,3 @@ test('should emit restifyDone event when request is fully served with error', fu clientDone = true; }); }); - -test('should emit warning if closed is called', function(t) { - let warningCalled = false; - SERVER.get('/ping/:name', function(req, res, next) { - function testWarning(warning) { - t.equal(warning.name, 'RestifyDeprecationWarning'); - t.equal(warning.code, 'RestifyDEPReqClosed'); - t.ok(warning.stack); - warningCalled = true; - - res.send('ok'); - return next(); - } - process.once('warning', testWarning); - t.notOk(req.closed()); - }); - - CLIENT.get('/ping/lagavulin', function(err, _, res) { - t.ifError(err); - t.equal(res.statusCode, 200); - t.ok(warningCalled); - t.end(); - }); -});