Skip to content

fix: support v18.x #1929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
node-version:
- 14.x
- 16.x
- 18.x
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
Expand Down
20 changes: 0 additions & 20 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

'use strict';

const { emitWarning } = require('node:process');
var url = require('url');
var sprintf = require('util').format;

Expand Down Expand Up @@ -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.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function Server(options) {

if (addr) {
str +=
addr.family === 'IPv6'
addr.family === 'IPv6' || addr.family === 6
? '[' + addr.address + ']'
: addr.address;
str += ':';
Expand Down
24 changes: 0 additions & 24 deletions test/request.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});