refactor: upgraded @types/cors

This commit is contained in:
Stijn Taelemans
2021-02-10 10:51:07 +01:00
committed by Joachim Van Herwegen
parent 38b1c98cb6
commit 9b6eab27bc
3 changed files with 14 additions and 10 deletions

View File

@@ -1,6 +1,5 @@
import cors from 'cors';
import type { CorsOptions } from 'cors';
import type { RequestHandler } from 'express';
import type { CorsOptions, CorsRequest } from 'cors';
import type { HttpHandlerInput } from '../HttpHandler';
import { HttpHandler } from '../HttpHandler';
@@ -30,7 +29,15 @@ interface SimpleCorsOptions {
* Full details: https://solid.github.io/specification/protocol#cors-server
*/
export class CorsHandler extends HttpHandler {
private readonly corsHandler: RequestHandler;
private readonly corsHandler: (
req: CorsRequest,
res: {
statusCode?: number;
setHeader: (key: string, value: string) => any;
end: () => any;
},
next: (err?: any) => any,
) => void;
public constructor(options: SimpleCorsOptions = {}) {
super();