@aseifu/cloudflare-router
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -8,3 +8,3 @@ | ||
interface CustomRequest extends Request { | ||
params?: Params; | ||
params: Params; | ||
} | ||
@@ -20,3 +20,3 @@ | ||
const parseRoute = (route: string, url: string): { matched: boolean, params?: Params } => { | ||
const parseRoute = (route: string, url: string): { matched: boolean, params: Params } => { | ||
const routePattern = new RegExp('^' + route.replace(/:\w+/g, '([^/]+)') + '$'); | ||
@@ -35,3 +35,3 @@ const match = url.match(routePattern); | ||
return { matched: false }; | ||
return { matched: false, params: {} }; | ||
}; | ||
@@ -81,4 +81,3 @@ | ||
if (isMatched) { | ||
let customRequest: CustomRequest= request; | ||
customRequest.params = params; | ||
let customRequest: CustomRequest= { ...request, params}; | ||
matched = true; | ||
@@ -85,0 +84,0 @@ callback(customRequest, res); |
{ | ||
"name": "@aseifu/cloudflare-router", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A lightweight routing utility for Cloudflare Workers, enabling easy management of HTTP routes with support for dynamic URL parameters.", | ||
@@ -5,0 +5,0 @@ "main": "index.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6567
161