title: setheader gives error: "throw new Error('Can\'t set headers after they are sent.');"
body: <p>Getting this error while checking whether the user already voted or not. I suggest <code>setheader</code> thing is responsible.</p>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>index : function(req, res, next){ 
      if(req.method == "POST"){
          var aa =  Users.findOneByEmail(req.param('email'), function(err, data, next){
              if(err) res.serverError(err);
              console.log(data);
              if(data){
                  res.redirect('/users');
                  return;
              }
          });
  
          var data = {
              remoteip:  req.ip,
              challenge: req.body.recaptcha_challenge_field,
              response:  req.body.recaptcha_response_field
          };
  
          // console.log(data);
          var recaptcha = new Recaptcha(PUBLIC_KEY, PRIVATE_KEY,  data);
          recaptcha.verify(function(success, error_code) {
              if(!success){
                  return res.serverError(error_code)              
              } else {
                  var username =  req.param('username');
                  var vote =  req.param('vote');
                  var email = req.param('email');
                  var reason =  req.param('reason');
                  console.log('I am here 2');
                  Users.create({
                      username: req.param('username'),
                      email: email,
                      candidate_id : vote,
                      reason : reason
                  }).done(function(err, data){
                      if(err){
                          return res.serverError(JSON.stringify(err));
                      } else {
                          return res.send('You sucessfully voted');
                      }
                  });
              }
  
              res.redirect('/candidates/');
          });          
      } else {
          var recaptcha = new Recaptcha(PUBLIC_KEY, PRIVATE_KEY);
          Candidates.find().done(function(err, data){
              res.view({candidates : data, recaptcha_form: recaptcha.toHTML()});
          });
      }
  },
  </code></pre>
  
  <p><strong>The error:</strong></p>
  
  <pre><code>http.js:691     
      throw new Error('Can\'t set headers after they are sent.');
  Error: Can't set headers after they are sent.
      at ServerResponse.OutgoingMessage.setHeader (http.js:691:11)
      at ServerResponse.res.setHeader (/usr/local/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/patch.js:59:22)
      at ServerResponse.res.set.res.header (/Users/korotane/Documents/node_projects/the_next_indian_pm/node_modules/sails/node_modules/express/lib/response.js:522:10)
      at ServerResponse.res.location (/Users/korotane/Documents/node_projects/the_next_indian_pm/node_modules/sails/node_modules/express/lib/response.js:656:8)
      at ServerResponse.res.redirect (/Users/korotane/Documents/node_projects/the_next_indian_pm/node_modules/sails/node_modules/express/lib/response.js:698:8)
      at /Users/korotane/Documents/node_projects/the_next_indian_pm/api/controllers/UsersController.js:75:14
      at IncomingMessage.&lt;anonymous&gt; (/Users/korotane/Documents/node_projects/the_next_indian_pm/node_modules/recaptcha/lib/recaptcha.js:160:20)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:920:16
      at process._tickDomainCallback (node.js:459:13)
  </code></pre>