Fix: return type for restify's conditionaHandler; Added: test for restify's conditionalHandler

This commit is contained in:
leanazulyoro
2018-05-08 11:36:44 -03:00
parent 74a624759b
commit e54e1ba90e
2 changed files with 9 additions and 1 deletions

View File

@@ -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-*)

View File

@@ -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" });