hapi: fix incorrect connection.table() result type (#17070)

This commit is contained in:
Christian
2017-06-09 15:05:33 -07:00
committed by Andy
parent a2415a9ba3
commit 3b2f53cf6a
2 changed files with 18 additions and 3 deletions
+16 -3
View File
@@ -1256,13 +1256,14 @@ export interface RoutingTableEntry {
/**
* [See docs](https://hapijs.com/api/16.1.1#servertablehost) > return value
* For source [See source](https://github.com/hapijs/hapi/blob/v16.1.1/lib/route.js#L71)
*/
export interface Route {
/**
* the route config with defaults applied.
* TODO check type of RouteConfiguration here is correct
*/
settings: RouteConfiguration;
settings: RouteAdditionalConfigurationOptions;
/**
* the HTTP method in lower case.
* TODO, check if it can contain 'head' or not.
@@ -1270,6 +1271,18 @@ export interface Route {
method: HTTP_METHODS_PARTIAL_lowercase;
/** the route path. */
path: string;
params: string[];
connection: ServerConnection;
fingerprint: string;
plugin?: any;
public: RoutePublicInterface;
server: Server;
}
/**
@@ -1618,8 +1631,8 @@ export interface ServerConnection {
/** Described in server.inject [See docs](https://hapijs.com/api/16.1.1#serverinjectoptions-callback) */
inject(options: string | InjectedRequestOptions, callback: (res: InjectedResponseObject) => void): void;
inject(options: string | InjectedRequestOptions, ): Promise<InjectedResponseObject>;
/** Described in server.table [See docs](https://hapijs.com/api/16.1.1#servertablehost) */
table(host?: string): RoutingTableEntry;
/** Mentioned but not documented under server.connections [See docs](https://hapijs.com/api/16.1.1#serverconnections) */
table(host?: string): Route[];
/** Described in server.table [See docs](https://hapijs.com/api/16.1.1#serverlookupid) */
lookup(id: string): RoutePublicInterface | null;
/** Described in server.table [See docs](https://hapijs.com/api/16.1.1#servermatchmethod-path-host) */
+2
View File
@@ -18,3 +18,5 @@ const table = connection.table();
}
]
*/
table.map(({method, path, settings: {description}}) => { });