Skip to content

Conversation

vasunous
Copy link

No description provided.

@hob
Copy link

hob commented Oct 16, 2025

:shipit:

callback(null, true)
} else {
callback(null, false)
const allowedOriginsList = allowedOrigins.split(',').map((o) => o.trim().toLowerCase())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be pushed up for better readability and then the if condition can be rewritten asL

if (!origin || allowedOrigins == '*' || allowedOriginsList.includes(origin.toLowerCase())) {
     callback(null, true)
} else {
    callback(null, false)
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowedOriginsList.includes

I don't want to split "allowedOrigins" if it is just '*'. If it is not * then only it splits and compares with origin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants