@middy/http-router
Advanced tools
Comparing version 5.4.7 to 5.5.0
20
index.js
import { createError } from '@middy/util' | ||
const httpRouteHandler = (routes) => { | ||
const defaults = { | ||
routes: [], | ||
notFoundResponse: ({ method, path }) => { | ||
const err = createError(404, 'Route does not exist', { | ||
cause: { package: '@middy/http-router', data: { method, path } } | ||
}) | ||
throw err | ||
} | ||
} | ||
const httpRouteHandler = (opts = {}) => { | ||
if (Array.isArray(opts)) { | ||
opts = { routes: opts } | ||
} | ||
const { routes, notFoundResponse } = { ...defaults, ...opts } | ||
const routesStatic = {} | ||
@@ -59,5 +73,3 @@ const routesDynamic = {} | ||
// Not Found | ||
throw createError(404, 'Route does not exist', { | ||
cause: { package: '@middy/http-router', data: path } | ||
}) | ||
return notFoundResponse({ method, path }) | ||
} | ||
@@ -64,0 +76,0 @@ } |
{ | ||
"name": "@middy/http-router", | ||
"version": "5.4.7", | ||
"version": "5.5.0", | ||
"description": "HTTP event router for the middy framework", | ||
@@ -63,6 +63,6 @@ "type": "module", | ||
"dependencies": { | ||
"@middy/util": "5.4.7" | ||
"@middy/util": "5.5.0" | ||
}, | ||
"devDependencies": { | ||
"@middy/core": "5.4.7", | ||
"@middy/core": "5.5.0", | ||
"@types/aws-lambda": "^8.10.97" | ||
@@ -69,0 +69,0 @@ }, |
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
8857
143
+ Added@middy/util@5.5.0(transitive)
- Removed@middy/util@5.4.7(transitive)
Updated@middy/util@5.5.0