mirror of
https://github.com/scratchfoundation/restify-cors-middleware.git
synced 2024-12-18 20:02:22 -05:00
16 lines
467 B
JavaScript
16 lines
467 B
JavaScript
var util = require('util');
|
|
var preflight = require('./preflight');
|
|
var actual = require('./actual');
|
|
|
|
module.exports = function(options) {
|
|
|
|
if (! util.isArray(options.origins)) options.origins = ['*'];
|
|
if (! util.isArray(options.allowHeaders)) options.allowHeaders = [];
|
|
if (! util.isArray(options.exposeHeaders)) options.exposeHeaders = [];
|
|
|
|
return {
|
|
actual: actual.handler(options),
|
|
preflight: preflight.handler(options)
|
|
};
|
|
|
|
};
|