Skip to content

Commit e61fcbd

Browse files
committed
fix Express 4 warning
express deprecated res.send(status): Use res.sendStatus(status) instead node_modules/swagger-express/lib/swagger-express/index.js:299:22 This module is still supporting express 3.5.x, so for the time being, there is some quick check if the sendStatus method is defined
1 parent 6190d11 commit e61fcbd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/swagger-express/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ exports.init = function (app, opt) {
296296
resource = resources[match[1]];
297297

298298
if (!resource) {
299-
return res.send(404);
299+
//detect if it's express 4.x or 3.5.x
300+
return (res.sendStatus ? res.sendStatus(404) : res.send(404));
300301
}
301302

302303
result.resourcePath = resource.resourcePath;

0 commit comments

Comments
 (0)