# res.set

将响应的 HTTP 标头 field 设置为 value

# 概要

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])

Last Updated: 3/22/2023, 7:27:28 PM