mirror of
https://github.com/scratchfoundation/restify-cors-middleware.git
synced 2024-12-20 21:02:33 -05:00
don't run forEach on undefined. closes #44
This commit is contained in:
parent
c7eb8a84f3
commit
fcba706227
1 changed files with 5 additions and 3 deletions
|
@ -36,10 +36,12 @@ var constants = require('./constants.js')
|
|||
module.exports = function (options) {
|
||||
assert.object(options, 'options')
|
||||
assert.optionalArray(options.origins, 'options.origins')
|
||||
if (options.origins) {
|
||||
options.origins.forEach(function (o) {
|
||||
assert.ok(typeof o === 'string' || o instanceof RegExp, o +
|
||||
' is not a valid origin')
|
||||
})
|
||||
}
|
||||
assert.optionalBool(options.credentials, 'options.credentials')
|
||||
assert.optionalArrayOfString(options.allowHeaders, 'options.allowHeaders')
|
||||
assert.optionalArrayOfString(options.exposeHeaders,
|
||||
|
|
Loading…
Reference in a new issue