mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-24 22:17:06 +08:00
Fix: return type for restify's conditionaHandler; Added: test for restify's conditionalHandler
This commit is contained in:
2
types/restify/index.d.ts
vendored
2
types/restify/index.d.ts
vendored
@@ -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-*)
|
||||
|
||||
@@ -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" });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user