fix RouteRequest method type
This commit is contained in:
parent
ef5a205bda
commit
0f176fbe6b
|
@ -189,7 +189,7 @@ export const routeWithParamsRouteMatcher = (
|
||||||
): boolean => {
|
): boolean => {
|
||||||
const routeMatcherRegEx = new RegExp(`^${routeParamPattern(route.path)}$`);
|
const routeMatcherRegEx = new RegExp(`^${routeParamPattern(route.path)}$`);
|
||||||
return (
|
return (
|
||||||
req.method === route.method &&
|
req.method as HTTPMethod === route.method &&
|
||||||
route.path.includes("/:") &&
|
route.path.includes("/:") &&
|
||||||
routeMatcherRegEx.test(req.path)
|
routeMatcherRegEx.test(req.path)
|
||||||
);
|
);
|
||||||
|
@ -226,7 +226,7 @@ export class RouteRequest {
|
||||||
url: string;
|
url: string;
|
||||||
path: string;
|
path: string;
|
||||||
headers: Headers;
|
headers: Headers;
|
||||||
method: string;
|
method: HTTPMethod;
|
||||||
queryParams: { [key: string]: string };
|
queryParams: { [key: string]: string };
|
||||||
pathParams: { [key: string]: string };
|
pathParams: { [key: string]: string };
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ export class RouteRequest {
|
||||||
const urlObj = new URL(request.url);
|
const urlObj = new URL(request.url);
|
||||||
this.path = decodeURIComponent(urlObj.pathname);
|
this.path = decodeURIComponent(urlObj.pathname);
|
||||||
this.headers = request.headers;
|
this.headers = request.headers;
|
||||||
this.method = request.method;
|
this.method = request.method as HTTPMethod;
|
||||||
this.pathParams = {};
|
this.pathParams = {};
|
||||||
this.queryParams = this.paramsToObject(urlObj.searchParams.entries());
|
this.queryParams = this.paramsToObject(urlObj.searchParams.entries());
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user