Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
troygoode committed Jul 5, 2014
1 parent c78ed42 commit 0c843f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@

function cors(options, req, res, next) {
var headers = [],
method = req.method && req.method.toUpperCase && req.method.toUpperCase(),
applyHeaders = function (headers, res) {
headers.forEach(function (header) {
if (header && header.value) {
Expand All @@ -102,7 +103,6 @@
});
};

var method = req.method && req.method.toUpperCase && req.method.toUpperCase();
if (method === 'OPTIONS') {
// preflight
headers.push(configureOrigin(options, req));
Expand Down
11 changes: 5 additions & 6 deletions test/cors.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
var should = require('should'),
cors = require('../lib'),
fakeRequest = function (headers) {
var headers = headers || {
'origin': 'request.com',
'access-control-request-headers': 'requestedHeader1,requestedHeader2'
};
return {
headers: headers,
headers: headers || {
'origin': 'request.com',
'access-control-request-headers': 'requestedHeader1,requestedHeader2'
},
pause: function () {
// do nothing
return;
Expand Down Expand Up @@ -302,7 +301,7 @@
cors(options)(req, res, next);

req = fakeRequest({
'origin': 'invalid-request.com'
'origin': 'invalid-request.com'
});
res = fakeResponse();

Expand Down

0 comments on commit 0c843f9

Please sign in to comment.