@middy/http-router
Advanced tools
Comparing version 4.4.3 to 4.5.0
@@ -21,3 +21,3 @@ import { createError } from '@middy/util'; | ||
return (event, context, abort)=>{ | ||
const { method , path } = getVersionRoute[event.version ?? '1.0']?.(event); | ||
const { method , path } = getVersionRoute[pickVersion(event)]?.(event); | ||
if (!method) { | ||
@@ -84,2 +84,5 @@ throw new Error('[http-router] Unknown http event format'); | ||
}; | ||
const pickVersion = (event)=>{ | ||
return event.version ?? (event.method ? 'vpc' : '1.0'); | ||
}; | ||
const getVersionRoute = { | ||
@@ -93,2 +96,6 @@ '1.0': (event)=>({ | ||
path: event.requestContext.http.path | ||
}), | ||
vpc: (event)=>({ | ||
method: event.method, | ||
path: event.raw_path.split('?')[0] | ||
}) | ||
@@ -95,0 +102,0 @@ }; |
{ | ||
"name": "@middy/http-router", | ||
"version": "4.4.3", | ||
"version": "4.5.0", | ||
"description": "HTTP event router for the middy framework", | ||
@@ -69,9 +69,9 @@ "type": "module", | ||
"dependencies": { | ||
"@middy/util": "4.4.3" | ||
"@middy/util": "4.5.0" | ||
}, | ||
"devDependencies": { | ||
"@middy/core": "4.4.3", | ||
"@middy/core": "4.5.0", | ||
"@types/aws-lambda": "^8.10.97" | ||
}, | ||
"gitHead": "089df92081ae593696c59fad7c604c2ac2eebe1a" | ||
"gitHead": "200d1cd90c6e0bd25bb96c525cdebd1a74d813a6" | ||
} |
@@ -22,4 +22,5 @@ <div align="center"> | ||
</a> | ||
<a href="https://lgtm.com/projects/g/middyjs/middy/context:javascript"> | ||
<img src="https://img.shields.io/lgtm/grade/javascript/g/middyjs/middy.svg?logo=lgtm&logoWidth=18" alt="Language grade: JavaScript" style="max-width:100%;"> | ||
<a href="https://github.com/middyjs/middy/actions/workflows/sast.yml"> | ||
<img src="https://github.com/middyjs/middy/actions/workflows/sast.yml/badge.svg | ||
?branch=main&event=push" alt="CodeQL" style="max-width:100%;"> | ||
</a> | ||
@@ -26,0 +27,0 @@ <a href="https://bestpractices.coreinfrastructure.org/projects/5280"> |
Sorry, the diff of this file is not supported yet
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
16305
343
47
+ Added@middy/util@4.5.0(transitive)
- Removed@middy/util@4.4.3(transitive)
Updated@middy/util@4.5.0