diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index 30a5220022..bacea67cab 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -955,7 +955,7 @@ export namespace plugins { /** * Runs first handler that matches to the condition */ - function conditionalHandler(candidates: HandlerCandidate | HandlerCandidate[]): RequestHandler[]; + function conditionalHandler(candidates: HandlerCandidate | HandlerCandidate[]): RequestHandler; /** * Conditional headers (If-*) diff --git a/types/restify/restify-tests.ts b/types/restify/restify-tests.ts index 1ba9b05768..8601d912ac 100644 --- a/types/restify/restify-tests.ts +++ b/types/restify/restify-tests.ts @@ -148,6 +148,14 @@ server.use(restify.plugins.throttle({ } } })); +server.use(restify.plugins.conditionalHandler([{ + contentType: ['text/plain'], + handler: (req: restify.Request, res: restify.Response, next: restify.Next): void => { + res.send('OK'); + next(); + }, + version: '0.0.0', +}])); const logger = Logger.createLogger({ name: "test" });