add callback for res.writeHead