@middy/http-router
Advanced tools
Comparing version 3.5.0 to 3.6.0
@@ -0,1 +1,2 @@ | ||
var _event; | ||
import { createError } from '@middy/util'; | ||
@@ -30,3 +31,5 @@ const httpRouteHandler = (routes)=>{ | ||
for (const route of routesDynamic[method] ?? []){ | ||
if (route.path.test(path)) { | ||
const match = path.match(route.path); | ||
if (match) { | ||
(_event = event).pathParameters ?? (_event.pathParameters = match.groups); | ||
return route.handler(event, context, abort); | ||
@@ -39,3 +42,3 @@ } | ||
const regexpDynamicWildcards = /\/\{proxy\+\}$/; | ||
const regexpDynamicParameters = /\/\{[^/]+\}/g; | ||
const regexpDynamicParameters = /\/\{([^/]+)\}/g; | ||
const methods = [ | ||
@@ -72,3 +75,3 @@ 'GET', | ||
} | ||
path = path.replace(regexpDynamicWildcards, '/?.*').replace(regexpDynamicParameters, '/[^/]+'); | ||
path = path.replace(regexpDynamicWildcards, '/?(.*)').replace(regexpDynamicParameters, '/(?<$1>[^/]+)'); | ||
path = new RegExp(`^${path}/?$`); | ||
@@ -75,0 +78,0 @@ routesType[method].push({ |
{ | ||
"name": "@middy/http-router", | ||
"version": "3.5.0", | ||
"version": "3.6.0", | ||
"description": "HTTP event router for the middy framework", | ||
@@ -65,9 +65,9 @@ "type": "module", | ||
"dependencies": { | ||
"@middy/util": "3.5.0" | ||
"@middy/util": "3.6.0" | ||
}, | ||
"devDependencies": { | ||
"@middy/core": "3.5.0", | ||
"@middy/core": "3.6.0", | ||
"@types/aws-lambda": "^8.10.97" | ||
}, | ||
"gitHead": "61d1bb405d23702dd8ee83b65d8b98bef7acaeeb" | ||
"gitHead": "f45a017c3052f7c238eea88b98fee18a816dd317" | ||
} |
Sorry, the diff of this file is not supported yet
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
14462
214
+ Added@middy/util@3.6.0(transitive)
- Removed@middy/util@3.5.0(transitive)
Updated@middy/util@3.6.0