From d88a4e9f59bc8bcfb061bb1c0fea06d71015770f Mon Sep 17 00:00:00 2001 From: nguyenchr Date: Thu, 6 Oct 2016 00:09:39 +1100 Subject: [PATCH] Add missing var --- src/preflight.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/preflight.js b/src/preflight.js index dce54f6..ce4dee6 100644 --- a/src/preflight.js +++ b/src/preflight.js @@ -21,19 +21,19 @@ exports.handler = function(options) { if (req.method !== 'OPTIONS') return next(); // 6.2.1 and 6.2.2 - originHeader = req.headers['origin']; + var originHeader = req.headers['origin']; if (origin.match(originHeader, options.origins) === false) return next(); // 6.2.3 - requestedMethod = req.headers['access-control-request-method']; + var requestedMethod = req.headers['access-control-request-method']; if (!requestedMethod) return next(); // 6.2.4 - requestedHeaders = req.headers['access-control-request-headers']; + var requestedHeaders = req.headers['access-control-request-headers']; requestedHeaders = requestedHeaders ? requestedHeaders.split(', ') : []; - allowedMethods = [requestedMethod, 'OPTIONS']; - allowedHeaders = DEFAULT_ALLOW_HEADERS.concat(['x-requested-with']) + var allowedMethods = [requestedMethod, 'OPTIONS']; + var allowedHeaders = DEFAULT_ALLOW_HEADERS.concat(['x-requested-with']) .concat(options.allowHeaders); res.once('header', function() {