res.set(field [, value])

中英双语

将响应的 HTTP 标头 field 设置为 value。要一次设置多个字段,请将对象作为参数传递。

res.set('Content-Type', 'text/plain')

res.set({
  'Content-Type': 'text/plain',
  'Content-Length': '123',
  ETag: '12345'
})

别名为 res.header(field [, value])