Comparing version 0.23.0 to 0.24.0
{ | ||
"name": "middy", | ||
"version": "0.23.0", | ||
"version": "0.24.0", | ||
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -141,2 +141,8 @@ const middy = require('../../middy') | ||
handler.use({ | ||
onError: (handler, next) => { | ||
next() | ||
} | ||
}) | ||
const event = { | ||
@@ -155,2 +161,17 @@ httpMethod: 'GET' | ||
test('It should not swallow errors', () => { | ||
const handler = middy((event, context, cb) => { | ||
throw new Error('some-error') | ||
}) | ||
handler.use( | ||
cors() | ||
) | ||
handler({}, {}, (error, response) => { | ||
expect(response).toBe(undefined) | ||
expect(error.message).toEqual('some-error') | ||
}) | ||
}) | ||
test('It should not override already declared Access-Control-Allow-Headers header', () => { | ||
@@ -175,2 +196,7 @@ const handler = middy((event, context, cb) => { | ||
})) | ||
handler.use({ | ||
onError: (handler, next) => { | ||
next() | ||
} | ||
}) | ||
@@ -237,2 +263,7 @@ const event = { | ||
) | ||
handler.use({ | ||
onError: (handler, next) => { | ||
next() | ||
} | ||
}) | ||
@@ -274,2 +305,7 @@ const event = { | ||
) | ||
handler.use({ | ||
onError: (handler, next) => { | ||
next() | ||
} | ||
}) | ||
@@ -276,0 +312,0 @@ const event = { |
@@ -50,3 +50,3 @@ const defaults = { | ||
next() | ||
next(handler.error) | ||
} | ||
@@ -53,0 +53,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
171727
4337