mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix typing and codestyle
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
00aef47d3b
commit
e5f53e1616
@ -8,7 +8,7 @@ export interface LensApiResultContentType {
|
|||||||
resultMapper: (result: LensApiResult<any>) => ({
|
resultMapper: (result: LensApiResult<any>) => ({
|
||||||
statusCode: number;
|
statusCode: number;
|
||||||
content: any;
|
content: any;
|
||||||
headers: { [ name: string ]: string };
|
headers: Record<string, string>;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,8 +36,6 @@ describe("router", () => {
|
|||||||
instantiate: (): Route<any> => ({
|
instantiate: (): Route<any> => ({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/some-path",
|
path: "/some-path",
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
handler: routeHandlerMock,
|
handler: routeHandlerMock,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -66,7 +64,6 @@ describe("router", () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
responseStub = { end: jest.fn(), setHeader: jest.fn(), write: jest.fn(), statusCode: undefined };
|
responseStub = { end: jest.fn(), setHeader: jest.fn(), write: jest.fn(), statusCode: undefined };
|
||||||
|
|
||||||
clusterStub = {} as Cluster;
|
clusterStub = {} as Cluster;
|
||||||
|
|||||||
@ -50,7 +50,7 @@ export class Router {
|
|||||||
protected router = new Call.Router();
|
protected router = new Call.Router();
|
||||||
protected static rootPath = path.resolve(__static);
|
protected static rootPath = path.resolve(__static);
|
||||||
|
|
||||||
constructor(routes: Route<any>[], private dependencies: Dependencies) {
|
constructor(routes: Route<unknown>[], private dependencies: Dependencies) {
|
||||||
routes.forEach(route => {
|
routes.forEach(route => {
|
||||||
this.router.add({ method: route.method, path: route.path }, handleRoute(route));
|
this.router.add({ method: route.method, path: route.path }, handleRoute(route));
|
||||||
});
|
});
|
||||||
@ -118,7 +118,7 @@ export interface Route<TResponse> {
|
|||||||
handler: RouteHandler<TResponse>;
|
handler: RouteHandler<TResponse>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRoute = (route: Route<any>) => async (request: LensApiRequest, response: http.ServerResponse) => {
|
const handleRoute = (route: Route<unknown>) => async (request: LensApiRequest, response: http.ServerResponse) => {
|
||||||
let result: LensApiResult<any> | void;
|
let result: LensApiResult<any> | void;
|
||||||
|
|
||||||
const writeServerResponse = writeServerResponseFor(response);
|
const writeServerResponse = writeServerResponseFor(response);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user