mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-22 12:33:38 +08:00
Fix MiddlewareFunction interface
1. Change client request/response to server request/response, because the client ones are for when node is acting as a client (making outgoing requests), whereas here it’s acting as a server. This change is needed to work with express. 2. Change the `next` argument, because next (in express) is a function called with 0 or 1 arguments, where that argument can be an any (for the error). Next is decidedly *not* a function with the MiddlewareFunction signature. 3. Import express with a capital E, for consistency with Http, since we’re using it for its namespace.
This commit is contained in:
6
twilio/twilio.d.ts
vendored
6
twilio/twilio.d.ts
vendored
@@ -7,7 +7,7 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../q/Q.d.ts" />
|
||||
|
||||
import * as express from 'express';
|
||||
import * as Express from 'express';
|
||||
import * as Http from 'http';
|
||||
|
||||
import q = require('q');
|
||||
@@ -444,13 +444,13 @@ declare namespace twilio {
|
||||
}
|
||||
|
||||
// For interop with node middleware chains
|
||||
export interface MiddlewareFunction { (request: Http.ClientRequest, response: Http.ClientResponse, next: MiddlewareFunction): void; }
|
||||
export interface MiddlewareFunction { (request: Http.ServerRequest, response: Http.ServerResponse, next: Express.NextFunction): void; }
|
||||
|
||||
export function webhook(authToken: string, options?: webhookOptions): MiddlewareFunction;
|
||||
export function webhook(options?: webhookOptions): MiddlewareFunction;
|
||||
|
||||
export function validateRequest(authToken: string, twilioHeader: string, url: string, params?: any): boolean;
|
||||
export function validateExpressRequest(request: express.Request, authToken: string, options?: WebhookExpressOptions): boolean;
|
||||
export function validateExpressRequest(request: Express.Request, authToken: string, options?: WebhookExpressOptions): boolean;
|
||||
|
||||
/// resources/Accounts.js
|
||||
export interface OutgoingCallerIdInstance extends InstanceResource {
|
||||
|
||||
Reference in New Issue
Block a user