Socket
Socket
Sign inDemoInstall

@middy/http-cors

Package Overview
Dependencies
13
Maintainers
10
Versions
208
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-alpha.40 to 1.0.0-alpha.41

11

index.js

@@ -26,3 +26,3 @@ const getOrigin = (incomingOrigin, options) => {

if (handler.event.hasOwnProperty('httpMethod')) {
if (Object.prototype.hasOwnProperty.call(handler.event, 'httpMethod')) {
handler.response = handler.response || {}

@@ -32,3 +32,3 @@ handler.response.headers = handler.response.headers || {}

// Check if already setup Access-Control-Allow-Headers
if (options.headers !== null && !handler.response.headers.hasOwnProperty('Access-Control-Allow-Headers')) {
if (options.headers !== null && !Object.prototype.hasOwnProperty.call(handler.response.headers, 'Access-Control-Allow-Headers')) {
handler.response.headers['Access-Control-Allow-Headers'] = options.headers

@@ -38,3 +38,3 @@ }

// Check if already setup the header Access-Control-Allow-Credentials
if (handler.response.headers.hasOwnProperty('Access-Control-Allow-Credentials')) {
if (Object.prototype.hasOwnProperty.call(handler.response.headers, 'Access-Control-Allow-Credentials')) {
options.credentials = JSON.parse(handler.response.headers['Access-Control-Allow-Credentials'])

@@ -46,6 +46,7 @@ }

}
// Check if already setup the header Access-Control-Allow-Origin
if (!handler.response.headers.hasOwnProperty('Access-Control-Allow-Origin')) {
if (!Object.prototype.hasOwnProperty.call(handler.response.headers, 'Access-Control-Allow-Origin')) {
const headers = handler.event.headers || {}
const incomingOrigin = headers['origin'] || headers['Origin']
const incomingOrigin = headers.origin || headers.Origin
handler.response.headers['Access-Control-Allow-Origin'] = options.getOrigin(incomingOrigin, options)

@@ -52,0 +53,0 @@ }

{
"name": "@middy/http-cors",
"version": "1.0.0-alpha.40",
"version": "1.0.0-alpha.41",
"description": "CORS (Cross-Origin Resource Sharing) middleware for the middy framework",

@@ -44,3 +44,3 @@ "engines": {

},
"gitHead": "74c5e808c4658460bc198abd945ebefd4b7b6c90"
"gitHead": "aa244c76000d1896ada6d683637a7c280127aa79"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc