From e54e1ba90ece9c45226be130b85030bc7d00eb5a Mon Sep 17 00:00:00 2001 From: leanazulyoro Date: Tue, 8 May 2018 11:36:44 -0300 Subject: [PATCH] Fix: return type for restify's conditionaHandler; Added: test for restify's conditionalHandler --- types/restify/index.d.ts | 2 +- types/restify/restify-tests.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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" });