set status code before writing response

“The first time response.write() is called, it will send the buffered
header information and the first body to the client.”

http://nodejs.org/api/http.html#http_response_write_chunk_encoding