Node supports the res.headersSent these days, so you could/should use that. It is a read-only boolean indicating whether the headers have already been sent.
if(res.headersSent) { ... }
See http://nodejs.org/api/http.html#http_response_headerssent
Note: this is the preferred way of doing it, compared to the older Connect ‘headerSent’ property that Niko mentions.