res.headersSent

指示应用程序是否为响应发送 HTTP 标头的布尔属性。

Boolean property that indicates if the app sent HTTP headers for the response.

app.get('/', (req, res) => {
  console.log(res.headersSent) // false
  res.send('OK')
  console.log(res.headersSent) // true
})