title: How to send a custom http status message in node / express?
body: <p>My node.js app is modeled like the <a href="https://github.com/visionmedia/express/tree/master/examples/mvc" rel="noreferrer">express/examples/mvc</a> app. </p>
  
  <p>In a controller action I want to spit out a HTTP 400 status with a custom http message.
  By default the http status message is "Bad Request":</p>
  
  <pre><code>HTTP/1.1 400 Bad Request
  </code></pre>
  
  <p>But I want to send </p>
  
  <pre><code>HTTP/1.1 400 Current password does not match
  </code></pre>
  
  <p>I tried various ways but none of them set the http status message to my custom message.</p>
  
  <p>My current solution controller function looks like that:</p>
  
  <pre><code>exports.check = function( req, res) {
    if( req.param( 'val')!=='testme') {
      res.writeHead( 400, 'Current password does not match', {'content-type' : 'text/plain'});
      res.end( 'Current value does not match');
  
      return;
    } 
    // ...
  }
  </code></pre>
  
  <p>Everything works fine but ... it seems not the the right way to do it. </p>
  
  <p>Is there any better way to set the http status message using express ? </p>