响应

res 对象表示 Express 应用程序在收到 HTTP 请求时发送的 HTTP 响应。

在本文档中,按照惯例,该对象始终称为 res(HTTP 请求为 req),但其实际名称由您正在使用的回调函数的参数确定。

例如:

app.get('/user/:id', (req, res) => {
  res.send(`user ${req.params.id}`)
})

但你也可以拥有:

app.get('/user/:id', (request, response) => {
  response.send(`user ${request.params.id}`)
})

res对象是Node自带响应对象的增强版,支持所有内置字段和方法

res.app

B0Y2h48Xu5+yWZnT7DQ5LJ48597vRCp1HnoXgq8zxRBFjNXYf+QQqHpnOPZ0KaHh5j/SGF+zCdsfBlKL6801b/+tBE3PGDdhwpTQK0LR0LE=

gwwhARSEpweFsBPLbozTEoIQQNUmz3rImuUybYSYKSW6Ea9j10FfohNbTwHUUsFfv3D60VmeqZQjDi4kfO32aEHSC6ql3W5b/azHlq/Lc+DRWQEG1eB2bNT4GFnaQcfRvrgjYjs9tJXB8ZRMXTP8iPFZaYSLUMpbkwuDO3ca2pw=

res.headersSent

2IoXfMI0pR03y7wRTxB0IWSn8N6fU4aDixSwdj+J9B9dqugQd3K1tnhoFHXtrILcl5qO99bNqVFVh3fsSFicKGXVXnPldiLVZ0zeRxfj6EQ=

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

res.locals

iR9vjUyaud2KGpivgpEKz4djLEE03I0bVfK2rRDpQFZBrYkAYopUbIRoifXYIbiEwbUGW7uQ0J8kJkyc77ZesK6gyr5EYDyav3w07m8RMJUrGyNuD7T3dh7zdRjOTs7/NkTGOyQgRrq0T5YLgtLiHDkt17b76SzwG3aUHoM92uGAKqJpXqoorfX3Hsoz90CMddi6kUJIAII4Aox7k2lto9il7ka42Tp8799b0uMTjhPZdktdV0PktGZLZpdwGb5mf/yN8k8VuDyXp7Ao5IbwpHXrW4e4fcR9LZpj+DIkSlkmV8XFyRs2yy7WnezWVicv/07dXzdNmDNC6NX2+tzR2A==

2cNE9MfJyz3rlcPEiH3em2PiTf0Fi1QNCswP90v+Cub+7Td1DRxPfghcVgRemFEAWOrqWeGtdrd3JDfkugtaap9Z39Zu2IhE+TEziTg8PLhWtoF/Z3Onp4lzfYapCJCBCEk7NIzTA7aRXLDzRBu4+gYE1jndkfYlG1FGzzO1vPiVNxP/uBtZKJuOXrWWSrRA

itEFqgO/WDi6xecPH5KTpZeAQSHLpmwHeVCofCkQf5yrldRnMP0bAEnSpF8Pup0vnW13DPOZ0dCi5S68k0K9R7uqv9GzjlAxZr3mhqsFnovTGvOLDNZsSlVFgy4X4eI4vtS3y9yUYAXrHaoxngoO9HxpKHWZ68L04tB0upQeuMWXTNYviiOeB9Gg75RFCAcmzmmp8S/xVrVtwIL8wgZtjA==

app.use((req, res, next) => {
  // Make `user` and `authenticated` available in templates
  res.locals.user = req.user
  res.locals.authenticated = !req.user.anonymous
  next()
})

res.req

B0Y2h48Xu5+yWZnT7DQ5LJ3DMfJBuVjePZ/nCv7rlfnEHtAjYNX0RjGttt8jeGln8d0mnp18bY2v+pOtKg4kSmP0lcp+skGTcvikJokz2lp1y4oSH96nTrbP8A49LBAjuCSa2vagiHih+/Gmm1tuMVLqZ/ioo7Mmez/glNqWkqM=

res.append(field [, value])

pxGj8UUJB3FIjDumLfAYVswnjxXzyOijIqyiZlHxAplijE1iqfMsohlNJ0EVjWBHHaPjdB5lleklmI9To+RjGQ==

i5HbJGWo6+NI6/VlYdGLsbbr3piHTSnTHqPCFWM4ctiFmVjEzqP9TvcjO2Mn3nY26cRqANWWaX5la5d3qa6WihjwNiBuvFFKdeZ+U4TyjwDbLEmBxxw9KLADvU0KuIK9I2NRYDU4uyj0HwiFpuM2sJznkCIbT8XH5R5OVpg2kgivdKubAfhV9S6Tq0UxLSPLTcCxDvYq/xzF1pNaL18Jo1cwvzGGuK+Na9anxKtXtDLW2nXc0fq98jeowhFqComK/u0oideYE0kV14evIdcpBQ==

+3HJ/BiRN1wFLndPrJHxmMkyyjxlSivRhn/Z6eFigBcqFwaaUbuNmIx7Z1yuHAy3z8bIY4mdsSBAiFi0FwRuz7fDT2V4Zwdb6idITFmGYbKjhaDMYfBt5oq6/1MmjmmMxMU+ql6gKbFkVMCv1xU/Ix4kfb+UL4Mh42TAVBPu6pA=

res.append('Link', ['<http://localhost/>', '<http://localhost:3000/>'])
res.append('Set-Cookie', 'foo=bar; Path=/; HttpOnly')
res.append('Warning', '199 Miscellaneous warning')

res.attachment([filename])

gV0CgEWjf2ALsyQ4y5scwRqVEH0gdpn5xZfezI1pfQvbExW01zDCAoj7jA+igygGt9QRRjtH2CVyiCXMr0fXvAwkSq4+9Bc7SEcQQzxtRn/b/C+KgHSUR56avW5zyrKEUX/4ZRC24NujhAZpdJJ9guJuQQP34FcGJsBWBW4LmRi7Q23TthVfPQN+EfzhzaiL+Ezz9ZT4cjHxXi5ZPVkwlP08DGvNC+2MjwmlDhdGdon93ImqWu5WJResmFXSZrhxl98IeKYCYaxMFyMzufLwAFbxUdStAb/e3Z5iCQ/92ic2FaZSQoaPi2KbUBWPqgoQsTJglo/YO8AkvsPRt/OFGaPjqilHUH6QUs/Ht+ORl+o=

res.attachment()
// Content-Disposition: attachment

res.attachment('path/to/logo.png')
// Content-Disposition: attachment; filename="logo.png"
// Content-Type: image/png

oh5er8Jh1dOanP0IMwatg5cg7poNMUkNTE9nKIzQiDVFZZvmpow66Q/dCa5FNM4deOlDE8N1YUAUfE/vaYaoYCY7yTrw3gVeRoqPfdmoyZyO5DJ8sCvijTAw2m5iNXAzSemPEQywSOuDhBTo9JeTAq3/yCwl8sOMD6hOq6DzazQ1u0EqD7vAS0wRCWOCOqAk

MgO71yypnOaPB2lZbuh367cVTn/kf2wiFjadRW0QZie3z4xyBRy1hz3nb/hvwobWaZi7wzpxuCK+IMG7THg0yBKhZXHI+FKVEhSP4KTwgqA=

属性类型描述
domain字符串cookie 的域名。默认为应用的域名。
encode函数用于 cookie 值编码的同步函数。默认为 encodeURIComponent
expires日期格林威治标准时间 cookie 的到期日期。如果未指定或设置为 0,则创建会话 cookie。
httpOnly布尔值将 cookie 标记为只能由 Web 服务器访问。
maxAge数字方便的选项,用于设置相对于当前时间的到期时间(以毫秒为单位)。
path字符串cookie 的路径。默认为 "/"。
secure布尔值将 cookie 标记为仅与 HTTPS 一起使用。
signed布尔值指示是否应该对 cookie 进行签名。
sameSite布尔值或字符串"SameSite" Set-Cookie 属性的值。更多信息请参见 https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1

VV3oMaNJUGFWlw0wXfV6BZNyZPmsy0aX0V94d5xUtNf9WOa4oayr4871OtQeQdzWrMvM0CZAhNGy71CrWGVRshibb9shFdwCG5UQTfLeYjGTJviqGBmnPDR/q6Q5bjxr1ZRgIDmGZ9kZUFiD/2yBJqf54kHPDbfC1hRGTsqt1dbJrIuAgDxzC7QOXlOpDoOfeKLi4malSPr1lu7lKOzPloBg/mq6w28ZWRSMe9UfaALcX8xdCl3Xoq7kNF6zEafxZDH3gwo/6fWsnF6M5qn3kfk2ZFbi+BSr6O0MJv/4imY=

4h5+3DAGYIrQZh8xCRRFCA==

res.cookie('name', 'tobi', { domain: '.example.com', path: '/admin', secure: true })
res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true })

hwkj0a3rbrDy2rcWtjhO6yjdHpAkvrKvPpeCoPtikE5VfTUj9zUkRgFG79MTzgZJeyYRQSIA7o15NXwn+lVUBydZNEHrikGDk1B9liGK6BMYFEM6bgL3lKFtwxTHRz3Vf+6AenoIm+i5bdfNbvSrwA==

nhj2iKHMgw1Ukm8jaGyENaM4ZBpEZ3BFlTnGj8sh3jJ8QAv3AFOf+erNh/SGJ5MLihesdFegQhJPuCVRdTF7iTxcyUftWdlTN7hrj4zmeS72pfr7WyO4wWzAh8VmMwRo1wxzRpBj8TW86ouA7F/n8cfwJfOditl58iM+4vjz50G2vr2Hz3s9PhrmizV1yq45qhvDsm2sYFO+pPrzEUp8mSG2ZXy/FivBKCWEtrizR+8=

// Default encoding
res.cookie('some_cross_domain_cookie', 'http://mysubdomain.example.com', { domain: 'example.com' })
// Result: 'some_cross_domain_cookie=http%3A%2F%2Fmysubdomain.example.com; Domain=example.com; Path=/'

// Custom encoding
res.cookie('some_cross_domain_cookie', 'http://mysubdomain.example.com', { domain: 'example.com', encode: String })
// Result: 'some_cross_domain_cookie=http://mysubdomain.example.com; Domain=example.com; Path=/;'

BLKWsp+toQzNf1/e/tY4lELYrpONdUjlO1jO/t7R2wZP5YTXDZ3r5sHyeC1FOgAhIkNF4tNOkisfaxS2kE4+21lS4uhZEpulgnFJ89Zo3NOkAAWI6BTOhlJr2bB6LNFau/fDFcN1rHR8k8KjcVLSQCX/eP3N6iOpHHQji3eWISv9xR34MPciDQHT+ijDHd9v9xRG/b331c26VsttFYTNIsJfEOu7Ed7DtKPgQhx2VPk=

res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })

BAU5AAsKNwCjtcRgXKTwoqRvalLQzWS/vbOW4L2sfohMjI5OF8iEUl6bXchGfMETA2Benf8RCbO1+tGAtuAf/ic9CnRJMbBDbanSqzuCxiYgPKtAFq/VEerd0q1BmK9WqthJReVPvCNaQjEzXHdPvrae03LMgMDvIMfqMx7kjyT6sGsIdvM80XPHoker5Fl3

res.cookie('cart', { items: [1, 2, 3] })
res.cookie('cart', { items: [1, 2, 3] }, { maxAge: 900000 })

BpDIkXRUnkPiBz8iBceshHRho+n2gRQ/Ye0EOGheBhDUobeNi1kK4uP4CBLDHFAkUXNBvfKktLS9DV+CYNGZbJnI8zl7E8t0uauViSrVpajfUjo5stYhQH22GuSOKgszlPFe14qeeOMJEvUyyd3waLKJISNGlEyqeo75Ykj77Aahrdw58GIQikRn1B+bdDWqzJtG32YYQxU/ociR7FtgXxHX38mhyawdkaLW4kBPg74THq8XoAb9Fl2E0uVCprgtnvcSrUjFk3okVbNqwDtuKskdx0qEocfADhuMaEc6lt3I/SA9BfTlQ1VeeqaP1EawhnEZEikUB7bO53SAAHjyJAjilpkoruf4KvnPBVnRHcZV+l5JZeezzQiiyf5coiCz7OihZsIhhf88ozGYJ6y+rg==

res.cookie('name', 'tobi', { signed: true })

teL8UCAXGLM9jlv5eUzekNcXW1cd+paVdoffeFY6WmGsC7l9bxNF2Xme35oWbbbKI4OkDKN8TknymbvyQxeb8zcYn63eb4EgRgzW/kmgQNCPwLO1ZOfjaXcQe4CTQz3YyND792Yp6hO1GdeNzlIy+w==

res.clearCookie(name [, options])

YKnPK0Yj2LD+2oFYGjw/izFx8EchraGgwB9ll0ZKYivwKf0Rttwt0WSqrnXVNi7nNzX2rjy1Q+42PtLj/JAqZGxpp7xBrDoQK2WE+RJrO8WYjKNHl8QGUaVwNKDmz9FVIE/t8nz/O6gn+WmmXSmsLLKXUkZrjYQwTX26zPg2UQT3yW1AmwSP4/dPkV9xw/3gEpEg952o6KGxaVmSpPnCCvS3AqzdZYzNXc5YbzpFmLY=

/3dJ1xN3Jr3Sv260JQqSDu+sPV4Vikmu/KgdKM6v1NbL4WencxhdUdRZ4HTFNvfBLSKw0L+mpmwCGibnXFAnQlQMacDVRx8K5x1M/fVghE08aJTARB/tJMZJBxA+KOPg2MRwcp0l/6Xyj69Q/4RTevSwWc1vfmwOsu6zwpHaRGuohZ+nu32DYtRNocYHwWoDt++AiOSw6Jwqre18/qMwX3Zmgr39YJhsFR496VkrgxmcU5J4vyC9GdTd4iwXfsGQdEEbdMseQ65RfRPqGWHQlp2bDUTJ3seHXZyT9g9hekGrAMGMmVy/H3kuXuWj8Y7PGB1578rsRTYcjlUxUpffAA==

res.cookie('name', 'tobi', { path: '/admin' })
res.clearCookie('name', { path: '/admin' })

res.download(path [, filename] [, options] [, fn])

s812TKwe5wlP2+OHKHvAXpYoc5oRrgeJdzRX6YHd5uIIDwFM16BNvMOhrMfjL2MzzZcYGWyQpmo/9APHbibSRCGfJfDFxvuRGE8CJXsXGB8=

qnx8urzEVNfW5jxbKOs0dXfrRE+RMiKTwbLyFlcJGssbzPZrjCJI5WmgBW/oc8kb5egieCCJz1/Plk67oRRzQNEWEc9T4taeheggnLxbTyras1IzZTibS22vmgr8E2neq5aVZJzxXrL+9iyZK3SydLQAV7oZCyoteL/R9Ju3JpUWeIhU6z8sMO2hDkjCFj7+QP9b2UvYT8b3SzPJ27hT82Rx3z5qUrvGgz1Dp8cGa7C8gTLGKOuCIjv4LajMxKphIAJ+HBk1vxGkeNgEIBS6+1b/6Isa1aVUK/rJtagh6JSo7xzDHm6k+b1sEe1cpTrvyNEvSsjBUOZABM5tUBrY7GFMEFils+VecUrUfeL37K3sm9yQD7E1asLySoZe87hOLHDxO+ZxlCjftlHLzn518T6LOpj3L7UlH5OBGFt8dFgK8xKfDqjRjtg/xwxDLYJpWk0141P0Wvw6bfP0Ofq+VYdcxC0ylqqkCtrHvLPaCAU=

cXs5rqTMnyONSH4+JoxwvbUiM5xCN6gGVqPHyxPD1Rg/Dpk1Kmctnrz/umXuynzA0HVz3ZvSGei2ZzHEEod6EQ6sncv0m283tAOsAn6r5Ro=

s812TKwe5wlP2+OHKHvAXpYoc5oRrgeJdzRX6YHd5uIIDwFM16BNvMOhrMfjL2MzzZcYGWyQpmo/9APHbibSRCGfJfDFxvuRGE8CJXsXGB8=

属性描述默认可用性
maxAge设置 Cache-Control 标头的 max-age 属性(以毫秒为单位)或 ms 格式 中的字符串04.16+
lastModifiedLast-Modified 标头设置为操作系统上文件的最后修改日期。设置 false 以禁用它。启用4.16+
headers包含与文件一起服务的 HTTP 标头的对象。标题 Content-Disposition 将被 filename 参数覆盖。4.16+
dotfiles提供点文件的选项。可能的值为 "allow"、"deny"、"ignore"。"ignore"4.16+
acceptRanges启用或禁用接受范围请求。true4.16+
cacheControl启用或禁用设置 Cache-Control 响应标头。true4.16+
immutableCache-Control 响应标头中启用或禁用 immutable 指令。如果启用,还应指定 maxAge 选项以启用缓存。immutable 指令将阻止受支持的客户端在 maxAge 选项的生命周期内发出条件请求以检查文件是否已更改。false4.16+

K2Yh51UcMHYyy5d7aX6TeHlzcTxsWHBNXRWApGWwgA77l6RS/pGtbDYSJ5pyOS3xZP5mHPEXE5zIJdDui7h04LXNwr881ezHULuzFoK7/nXy8ez+WpyZgAqjIKzYiWBy+J9kOBjtjUPvTaHQkx8ds/sTN0ubkl49Kb+aWFbUb0bMLXeaL4w2WZX2uXGl1cl8q2uibfNNY1pxxFpxEa/TWqEj/4h0FXw3YJu6b18PnxLXtuuHnyEZWqINritLKpE0Q7Af8Ad02PbD1TQ9dvsybWn4aT2493hhUT4v3sO9Y8EKozZJAO1gQGntFPfKK2UCP5d05K2YTqmVN3nhOauCwQ==

res.download('/report-12345.pdf')

res.download('/report-12345.pdf', 'report.pdf')

res.download('/report-12345.pdf', 'report.pdf', (err) => {
  if (err) {
    // Handle error, but keep in mind the response may be partially-sent
    // so check res.headersSent
  } else {
    // decrement a download credit, etc.
  }
})

res.end([data] [, encoding])

AMJP5fi5NLmpwEqNK45CpIiekXt6uXQ4Xma5CdiCn6ocAqjSAJg8iQjNOos2kauLrpaTPyKQBN4Be8TTqbqdz9tGGI9quDmeB+sJQ98jgfdfC2NFXyAHXefDOtDQJBdTkVSyIl5ww3zxEQJlGZgD0j+by5eSp3HXQbr+JT8JJL0AjqSbXZnAbiVFo6Uc3PXOToU98RlTY7qv0aBPLLxyjy6/OloUOazjxmEQs8GOluA=

MvlPpH3y9M4ugl966D7Cnv+Qrztx4f2oqNELgD0He6abn9PMdlookE4BdywLh3nUQrn5Qae/6oDUjFWmsyXdJUdxgjN5RFtjjX7q98spA5cycBB1qCGX9IlT59lq0KoI+BOHsfn4KFU+OLhAuW6yO4GfeVn+jPcKjpGCMrNWmqwvVKDKr5gvpqhsSKBrY+n1+R8o5gVFs7D2E/Nw/88PexNEiQTKCFcnFoMumIRZg6TYwJJBal3AM2WHyY7Ya/4n+PX3w/vdVLVOmEep8Se3tGlVFCcZ9dqQ9qL9H3JgaMmQ1WcSohkkMPxirORDR7Za

res.end()
res.status(404).end()

res.format(object)

EyGs13NS1ygoxKPLJcyiJijEmRwQasmHu7qfykDZmDBO3vizjfRKn3kDxF2AMIkLpTNGYevGBSx0k5h4yb/EXysl68IuhJckTwE0X0A/vQxGZB9/oIcwa76tYxX6OdXYaTFryz0gUQ4Ni8M/RgKWp2INwysvPIhhXnGP/tcgoag7XelWr9OXsCM1kYXWFbq8Vn9KPef9oR1QHxG8DVo+lfoU49IEA/KaBXwcYPI1dXEWR1gXLo8yJ7LKO/pm4KCbdQCTm8kP3sNKEYzrTvw294BCdqvFrP7cyYu2sLI8/QtpdVo3pkmw/fvjZR4My4zhgOYLTw/vCLF2YnQ0Vvj73QJ+0soytcEDJHpZk5IEZEUTX1tPR/aoC3s9oxyzPEK0uGXzavuVJ2x0hvvwXXkdr9Nfv3cm1jhI1imwE+4GdGUq/nkpRXvrkf2QYTEO1k6zsoRkgVkgjfexzUYQueLDXkNSNZh1aQvApe6lj0hrimU72pAwVXCGBWYwW5D/JYL9x1mH3VYnPn3feEwHVAjbTg==

0B92Jm65jVWAYkOWst75Gr+jsPPN2QeiISO2bZEnuQvgHmD8mSBzao4Ap7mK6eu18/2TRXMYexg5CDjHVwOWIXn4KUfGVFDZYJPeX4DtCm6gvv2LagKlSr/toz6Eidq75Gtgne6qwBdLW4C/xq4x64fArJHZingXl7AvEF5hP6V2BCQcAaAUw2HvtlcoqxZ5aoDO++5jjc2jTSiG9rX4e4wlwA8HEau5QQdVPSPvha4=

QzVfICJk57qlct1qrwudWZPSYNh1hrIbYdGiH8TSy4gUdO9AORHac/cC30zOR9For9Cy8mFf+OLltEB6fYKF2yC4el1wpj/eB30qfsPDc/b9mMn10ofZzIHcRaxHNYXaBekoZCgkEVcMDvkMqBa+MRIn0juc9WeXz7MoghDw4Dno7L8dMP9JWGTIW1KvDDUerxpwp3Kg9F8dr4FrjUgNsiGALthteS+3emEKsWtdWT51dr4HDRtxjzyAVtx8V1S5ZUux7kJ2UftKsaqK3UhYOg==

res.format({
  'text/plain' () {
    res.send('hey')
  },

  'text/html' () {
    res.send('<p>hey</p>')
  },

  'application/json' () {
    res.send({ message: 'hey' })
  },

  default () {
    // log the request and respond with 406
    res.status(406).send('Not Acceptable')
  }
})

TjRqLRF3Z2CLRZhs37u8p8gjvW+D+jQA/QCqtl1pOdjw8tIagBfZLsVQ6us9nIqp3I6UAOGbzw3GDPqSzxvdwOU7D+/I29zXQCpUZAR7W6VWYCaCi0hgn4K0iXcD/yN4ssbLBbfli5d3Kqtcobru5pTKQgAwApxASuYUjzlGfRRI2IzCoJrQMwY/GU6ESmac

res.format({
  text () {
    res.send('hey')
  },

  html () {
    res.send('<p>hey</p>')
  },

  json () {
    res.send({ message: 'hey' })
  }
})

res.get(field)

3m/VBIxoF0f9CEElnjuslQNB/HTBkP9XP7clBzoyCJC3S8eqxsAsrR3/9HxgLMkl8UtK1pasylL7aDWt/1kV/uWWk3BzTmv/gdFE+YQdN+Msovbx+B4/WYm86jg4uT5C

res.get('Content-Type')
// => "text/plain"

res.json([body])

3t3wj3vEnZjMqhBoVXoiJzT7UY+L4dnzWVfa4untD0XNV4KjcweQS7EyHvgKUfi5ENvDqvGm8pDHeuvUBnGtt3I6xepiFTDvlN95JNZgRoHBfQCLthg9+ahbITVBQmK8y9LgybxA8xWiLOAxWB+anugarjw1D3+ytuIrCSzLfsrQHjGWSjIwuR+En+Bc/2bSv9DtmW4n1OKU7bG1q3cBA2E2WWPkEJfnftXFxC5uBuOEVNfV3wc3TcHlfmDdg5IIJVzjnawYmnXBUB79tT5Vyw==

lFzb+wegph0K3vA8DrIGYs7BlwZ/mAJwbJa3G3rYTstu/XYOcRniMxgroHzGfk8FY5swhSVsH1d0GXIqpzc0/khYiertECIOYgqpARKTcCvOT0mIHsmTUdsQTfrVV2SC7Mbaxe1xL+Qcpa9gNxR66k9JGva66H1RmP6YuBOwiAYONzX81GSdousr9mALNeLbjduOmoJ1XqyKSCfo8t+wMQ==

res.json(null)
res.json({ user: 'tobi' })
res.status(500).json({ error: 'message' })

res.jsonp([body])

FFIANL49NBWBFStlbB81ckGc5lK4G195fDML9qLfkoVYbKUI4q+ePq3npfcGYQ4buItnOBagr49pTFobp4nnFc+A/JGNo534XM7sKC+lE6OLzCjcpmZbuis098GCzisqqH+5NB6i7/d/nNsMkz3SsWqFjEGeAk4yP/hz/bBErWFcNpO2FDGMeKxaV6Y7eQc4

res.jsonp(null)
// => callback(null)

res.jsonp({ user: 'tobi' })
// => callback({ "user": "tobi" })

res.status(500).jsonp({ error: 'message' })
// => callback({ "error": "message" })

DYLORq6DO0eCCJJX1ne2KFF+Y1f17KBJibrSoOKVvrSGnWnvDbaL2rJIfpvWuvWORF3nbg2fHUFB4kGEUqEfKtMwOwsQbsymAMAQT4JrFP20YaQscz7OacSQIEdn/E9Z5b/uN7Sby7KSy48ljai75uC974yEbMaog9C2hmfkCaBL5zCirrH/BxsESljuUTcxUGyLjTjkG1eqGRAxra7BKg==

GCsLiz8R8kSiZpxG27Z+cToWaW8NhxOsS1+Yo4LeoWlupPLioHdHM5pgaKE0zveEUvlf0zAKdrETiBijUJwACw==

// ?callback=foo
res.jsonp({ user: 'tobi' })
// => foo({ "user": "tobi" })

app.set('jsonp callback name', 'cb')

// ?cb=foo
res.status(500).jsonp({ error: 'message' })
// => foo({ "error": "message" })

NjBqfh78t2a2bNPSe7kD36GxH8OWW+D16cmGVc7pz18CqVJl4mnhgnp34YXHzIWfySup6FB6yltQorFhcNL5IfdTPbLC2JFg8b0w5+t040vVCfoFyvWPzAeCkRVV0oVeVeLDWDawGlmJ+DBcoi0d5Q==

NYGtsVyhZrU5bjvt+HfLHK5oPmvtt3xXqvOZ/Sr2k+E=

res.links({
  next: 'http://api.example.com/users?page=2',
  last: 'http://api.example.com/users?page=5'
})

pRATwS3c7wEPA4obrh4Zj+0V65GRG4XZycKv9eOCb94=

Link: <http://api.example.com/users?page=2>; rel="next",
      <http://api.example.com/users?page=5>; rel="last"

res.location(path)

8MZzccckY8LEgmEqZ+48f5mJKPqz74ParKn3fxX/pAQ7OU/IdaIgTCAnhzrPz3I4N+rS2tok9qeqEbvgpkfcdiYPitwpnkcjqSYDlJaigPD72AvPngVCxOW4pQWvPIla

res.location('/foo/bar')
res.location('http://example.com')
res.location('back')

DkdWwQluyWHtXmqhuaLyG6/wiWiAj3S753sxoqPQhvbyNbdAAEkrt642trqVWbKijVo6Zd83ldS05HYXdT/zQDUx2g+SH+XyzwYN/qYwYdJom+iyXALZyUU4coazSTWW53GsxD+sHXIwRSB+cqzqW+uMAr8C1m7d/nJWEB/RgIangE/BWE5CxCSO+juetH38RMaTuk5ZGQgnVivHo/v8KhPq3opiUY8NuSwS96maJuxB4rMztfiGkA1VSBZG0hj0

iLt3yHbU5bpeTtXTBJCUsCpwQOtEtxZRHp3AxXdqC3gLcYGzJaJ1VWI5fYMkEHx52GqlyiEYpMHUoCSOW4etllamXyLviDWYvcd6XuatPAqS7UEAzO60DnfeOgZ+G5oByGn8CNNwosX8swRNOagnx3TtRPq8JxKSTd9GuMDNCd7RCJemHt1nia/D0z84pLJdcMNEHfwga3Gy+jDsqGuLC5DSlWfxosV5VvKMhVf6/fg=

NK6xs3DuURi8yZe2ENQJ75VTr5B07uWWRA9j+kUz88OdkVVMAHCsRIWvL65932ZyT61V3xZfzkuAtdN9sUkIaj5uyr54GcZSrAGDR39O3eYH7vTeCFydFW/+4if3nGR5PPMQwjpV3a1Ht3POdhIp4a0o5+FowsB+UTzCrKmRq9zRddzgcs/Qd+J1P8yjohC1Cz71ppofBLP2Ky/loTEfhg==

res.redirect([status,] path)

j5hkxoOvQSkGc+6F1wcLytFmVg5D0v2kTgQV8nyvXNeAf8phe4sZ1TmARAYjK5+aqvzR0t1j3hWqR9c7vpErIw0FH7WBesRLmeZJoSEoCszCg8cyO8hMxnBorIXPt+z/2fuSmzPVK9Z4CDNlZxUl7mqeX9NYUEJlugqBUAh014ftUBIePpKnrfhxW+LIVxK49I1R3qgdUy/Tg+JkLEial7ZXyfGuXEdXLmPq7E5uSl7C1un/4hULAyKbpokMr1TaIRBSb5hPtU7WBOyld7WKhUhYNRwPOgkkqNNF4NAUoTAf3eDMRVB7hCKpYTIb89lTs03w0+KmzEHpFpIpDI3VLA==

res.redirect('/foo/bar')
res.redirect('http://example.com')
res.redirect(301, 'http://example.com')
res.redirect('../login')

jOhGsR4oUwRwn8GzUK0RU70MC5bELmYrLIPy5mIvM+9ag4A0FpMdaDxhPH1/T4NLMstUU8t2p5SDkYeAgJrM+F4MVEd2aF5XrslVPOsiynQ=

res.redirect('http://google.com')

g4Ogr/o8ZSpFFVqJ2KTp5bvpIq+X3+xhIuHLxkKuD7iYfaNHujdXuZnVi5qBstXBIBgX20PaMbpaGCGD/dcNUzyenmvGPLtfalXo2qpAthxIpQo6CoNxhVaQWIPnrRd9vw5vy1va80QIcwg5lGng37mGo/PjgHM5Ttesmb0EhSea+rHtRsyZcbs4h8IX4w4NuTEhHaUO+1e0lS/H4NqM1k6bapJgI0KxXpXOrE9XoOm6/TgfN9Yl4VFubS52jdnk3225ID4inSVDtUDkcZko0bb8xjOG15hlZj3tbpqjSO0=

res.redirect('/admin')

g4Ogr/o8ZSpFFVqJ2KTp5ajLuEabK2H+ZW64OrbIgEb/6pJ98sJXqKZHFGapMPuUDGNXHgPZslWJpdxhRvEtopFyeQykPgXuyXW3gNTnPxQb0tklVbJOmvoOPgtv7jDOIWRvy5w2lc+gdQtsdIkCurnVb5ThxVMkFfvhjZiblR5CdgatiqMD9jWo/Hd1OUdr6mSdUFE5XIZXO9kVEJVPIV3p5mPlshq2hhIwaVmNm87PiwI5PNuOnTCXvSyKSQEC11EDfSD2Br+mdiZB5VJHa8MjKa5hEtWbybg8csrDrTI=

res.redirect('post/new')

6ooY3NshB2DYjZ5oqWcIoDhFgz0XdQ7ObD1lda8AHyuPZu7ctCefZPOgRbdps4/GUNRFKdkumNfhytYaPKUtNYv/b1B/dFMuUwwQt3SXMnGA8j3yA16pg4kj+qGsxjHRMYOEE15kNdGXxfuAHkgrxe0BYDUBMQ+ozS+1CE+wVB8ApF+JRfJvIm+bL+d7btaXDRT6VB8zjFmkKIBzwJrdVCis3zUU6WalwKGWGZua1O8=

Yd67L/a+R3HibIY6ZIgYk7G59ABUB3sJjkBwjNyEefXWIkspQb85UNl+PQ0XC0ne5XaXH+uz60fSVnrhmRqntBlmThgg2/goLRwY4Twza52kce9PCvsuGmDPQeGfe/FvaLHib0JLrA6Yc0sLh/kd5kmChq9fQlA+ZeJAf5ixwcEWoDSRaopeNED/XzwaTTek

xGThIXakp32WQu5oDXaaecWD0LZY+yqmK8C47B5+ow3WLQy+7bTXWgzl/0utopudKNPJOsJYi3Vt7xP/+BrxI+5BfdBPT8Rv7j6ZPLv7OcOTRnsRaAE7cZr+CO1hHdFcKJM/Jj5RYFOcEPFEYF4c8+ez0tfHeXDZgl6yxV/CRIhXMFGkOuk1eL7nt+U66vJkXv9QY7AX9QXoBLrEtGkHH7kfYKQe24ih8LIuuIB3uFU=

res.redirect('..')

xQ7kG8ITO0PMirikxjYWKsiLgC3Cjobn6KUdYT2vjmo+PT3Zo9WKJhpAP/9galQ3tBhAgY2aL++Vae0/tScW3AlSUxDJuiWfTUvYmIbjMp3mmoBGVjdrwB5cICKXELNfO2KgqUqKOoWsPfAhv9NrHpoOHOk6Q0xal973qB1T5eX/NWG7aQfonuklUkd9b2QXxQzGlgKjZKDY89fCnNnlyQ==

res.redirect('back')

res.render(view [, locals] [, callback])

D1P23McpDNuTGx07KXxnce7/bSpe3TB+zr4Rc8/a2UJT2DNkR/yTalpgfzgvOuuy1oTEK7/f5EgybysotGkeIiL72QXGXjQv6npa+StgSmNYkxNffjWMX8E9fgBacmR1

    6YpbUN5sYS/JDMkgVN/CFQ4+6drWWSJH2kaqDuxZeV3knY3M0DAf3BX9MvcShi2Ke6NdiddYZHGQXOYA5Z3rMD0hVoUA/fBx4RoBqqmyF2deCSa0AJSCyOcBjCcH28J+0msONuDCPlmD/xU8HZMH/26DQofVRgI2/iP8jtDvLbJIpA5IysiQcp42dJ9J6tPSdwRWyYaylaiih2q61Kz69RfigfPLqHN6xOuIp39OJdmWwcKJ3u2lcGvHmY55mPSWZxpqoMCptm8XPdMaejHozbY9t003bnUEX47Fk08pL8gSPmOiIRp4lyZ7t2drdOtM7LGzQO3ajMcj4YE47DvymfntfWMGxpXBmnn51AgcpU1biYFLYA5C+VgT1R4X8Ri1S6EJub6/+8e1tnaM9YnEyMbVz+j+7aL9M0QTWJqYvzA=

W3YC/gsB6fmX97QeDWsM0qiLTkZwl+OvympKBg1vJROYwCURVV+mtEoMueRXKLL+pxXouZsGVGeRzkjVaToUsrU+TXI4QsT7/yDdOZBAO8xXmV3YittT5pctdiITuGAWRRCG3dqwCyj+WoeNOiUws9oBhv/E3pfZDW4D3O/6w5kaLRwo05WGqd3thX6SNpVsb7tjr8LcSdRq6IFV/8C+G9TIwUV8WJ7XvpsKphsLi25Td4smkaTsPnVwflbCtkVrBdEPBB8Z0t9RrYmyDnAoCZ9jNvGzmgLFo1NolX6usRG9YRhlTOxLeWFsFywqNIK44jTtrDrxQ8+GT6EfmNy3DZUjEs7Z5yHbjg4PST+JlJB6+Z0Fus0/h/f73SETvBewB56R0IEAj7e4HNoEdaI4Dhn86q4Pkrsvu67jnMXlrHdsdJqeo0ZpKqBCf0fG4bxfCHA4TnFBARdkT0jVy5MKvSxLQwwIQUzhf0wbywQcivYCtkJfHvnPepziEhpjfuVhZqGSrXVT80TbM2tw6qiFBRH3MWExoVOd0d+FuzTbqj8UOpT4gcKSP8KrIFNJGFAF9j9Xp2Xu0fkkAlIucaUlJ+gF0uhTDIRhgDeDdFk3muBgpli4sMENdjm0bVgl+ZOh

Y9pN1fI8Fb4bWt531dL/PgZ63imaIh80jl5gbkv3vW5ROqjGruOsnpQ+2qGLCtdeyZHNNL9m0HaCs0NtTaVuoJ7TxXU92/NhmeTYEB4Jm0+afU3C52MgURgUzAhH+r3Y73hFpHfes7P5z6fMY+u4mw==

pSFqssUbvHHcndCoJDmOkyxl0KxvcJm243wjyxJyHajP1w7SmeMnIzQlcbLE0tHyCh7tWFIeovHYVX+QrdwI6UIx6CzT20jV3Cxq+bw/iq7qjOYf1WsQbDcRnLGh7A4pzzeXU1WZ25FdbC1uAChSsF4HQcoLb/UGrF8HGoXVSnqH3tPpVBZRpCV+nvhnFYE36l5N95QgMtMJHaANSbu0SoHyei9amFHaFXqB3GfFiFIYgIcRCOb2s4S/jZamZ1OJsTNFSo454RmkFuWnIwbO7g==

MvTJ25YK37i7y3NdWv5m4N8Hm8q67MfP0399AaCpPMzoL9IQgmqmOVKZSXBiXT4PRiilsE4tjXlJ+6uIt2okQheteFOkHwlzdSXFZ9RWllavZkjcbuuuTtISSujHxnndJxx8TxcaYx2XhHqFEtHwnZwVfsjmAAvpqDaS3FROc8uSFDFeYiC4GREZGKNt94X5heHayrm9Lk2la9uRU+1cWQ==

// send the rendered view to the client
res.render('index')

// if a callback is specified, the rendered HTML string has to be sent explicitly
res.render('index', (err, html) => {
  res.send(html)
})

// pass a local variable to the view
res.render('user', { name: 'Tobi' }, (err, html) => {
  // ...
})

res.send([body])

wzi6vidgrKAxYM85X3/Czotd7fznmHCQ/9+Knh2Eo6c=

CX/guey8MlZYBEVDJmHnWYd4MKoxa5AELC2TLO2o+jZAPDx7kVP5Ba+TqMPETKFWI9ADOBbYzJoS90YHbGeEw5DlstMw5TDgqlDMHKlOtTcUV3p8c5H0i7ugwHVqzzeWxT/8RN8JcESL1MKS2LBDTHYUW7tOTvCeVunulb2QNvtX9JlDg92pA0PhcUKPTaWaY8WueMXG3pP1+DI35t762A==

res.send(Buffer.from('whoop'))
res.send({ some: 'json' })
res.send('<p>some html</p>')
res.status(404).send('Sorry, we cannot find that!')
res.status(500).send({ error: 'something blew up' })

HLntTS6krZKgB6xVVAIshzg3/3r4kRkHOUJcc4nLg6Jr0B4KAetabZ/fu/5K/nafECrmu5sTP0DqIIllL37s1CcAka7Oy01p+aL/piu2WqPyAfxfh5Q5yus1soUdrw9LgSq/xqvlkluuzCPPC/GGU5KMOy7tlfkB5Q8gqJXIeBWLEDPGkOnk6W67Br8+niwKy8/MZwWo/y8ooapuPjsa0m5qU+qx4ip9atCpbHcu1odXYGDrFJ7OMxNB3h3lzjstx9zUCf+t0gzU0ZE/WAw1//4GdIeQkLczjXHsDgjXSGM=

tXVVRIii47FAJOFSb9ZbQLacPfYpuN7ufaJxkzmhFzoj+t86IdyvtTIZOCYmaV8ATlq7NLno9agsxssxdOFGD61aH9fqLxRbiFZIOXZAYwAOr+CnlZ+DgBUrIv7vSFvJu3f5oYfJXJmuFy/CF3g4HV6dGETNEFjiyyoiwqWLRKTED94lzO554H+ZxoESBEAb1TLyNv9mD6t8RnZm8+aXLZivw7HpwJrSc7NHEz7TNNg=

res.set('Content-Type', 'text/html')
res.send(Buffer.from('<p>some html</p>'))

tXVVRIii47FAJOFSb9ZbQIZ0vZPBa5XObWS2F2midRkpYMmC4alQaHMXuqy5s86TPU36BIEczcSlQ/tbCfchL1eOKVcajCGyJ7F+skqjnyDbOzhbppSJBiebzter5w/pvsmxE96mOylyknsf+qWpUA==

res.send('<p>some html</p>')

tXVVRIii47FAJOFSb9ZbQMVbb6W/mc+hXExivnb1/h4p7+nr/RZqvvt61dAU5yxxL02ozgiXjpVwyJ2H0yGN3HFTn/Ed+xs5xVnrFMrkZitc0mLeqF74FV0eo73pkC7a2mOz+YgnsoQtH9e23Jb2xQ==

res.send({ user: 'tobi' })
res.send([1, 2, 3])

res.sendFile(path [, options] [, fn])

tNyy3YmpqIycnojmAhveAab6tLmyFnngoYSKZFXG7UmWp/AXEzR4IV/kCvLYP+xdeTFImcp698gKMvots0oYv2PnwjlwkLn5sReYH4o6PLE=

DIvD8ZZ7BPe68EiNiB2w552IDF398xDv2SksWWe+dg0csELsHWz/S/t6m/dPmAccL/4kG5otn5oz/CK6QgzIf79cJwHQWPLe3EFCbGVVP5k3dSla+mQkSo3Hzr7KU+DwNmP1yq6Jlcz2A331kFdMbUw0/09/94uwLZMmB7PULWgWLL4KkeR/MnWNm/BrU7M25+fOO7Dybmtn4ReshmpB12qbVPr+hsIz1RucwSzmMutBwg++itWHQe0/+8EvB2ncgHxda1QV0x8H+KzT/y4tposOI3chvYfC++m44b56/YEh1DfSdoj5UzxYRyTcCDrdUz9Z9ccMvqY0pp2XatZeKg==

VE41VXp+WcP8JJMYivX8zCG3/U44rOjUYLifJIz1EUzCTnjGjreNMGY3ua2TsO+vvkYpTJNeFu1D9Msrb+47xLmaz5pe6AycRpVyGp13ElXbyRP7FTtYC8sNjy5F1zF1AQuuxSkk2W9cmaBQZuoFTyutUExU3QwPk1rIE5dfgtIOJN+vynXDPn55bAhXMjEAWqadTTPyUhlrUs1GzpwMYJ2pnSaIRja1D/7sVSxMCtJEIs+eAWt5m5N7tTlPwydAL2jIdVo3o+amLwxJXOXHY/h5PQD33w47TvLWENxzx5pFZLnDycq3jIfwOJDobefNZ4Z8IzV/QJeredGBmO7k6eXFYDTuXfWkEQnMM+7pNWqOdaXgMk0T5L20nNQoI6RJ

gG2X3kqgNXiX1qMjEZqxyI6XWSAzHkmdwG4sJUnL6HLcJgIcXCwNaC36ABqCrQKGcgnJKVFjNnhZLeSNgPJrqJlScjvyXTHYjYh1wpwpURfFbxx96fLiaPzKisLHEEOFGruHqin/uOzJZN6bH83SaSXkF7KTvIaQOy4NaXEF/lFwWZkgcD3XhX8KnA7fkPvyTlNppvs3yy7sH1fSFheRBAdBRr3ZsLCEkeMRvWtjG2ilmYBh+Fz9l1OgUGmOHqUgEcM25SNzd0BuNgXd0hM+1+MI8Lto2LqkaBA76tZ1w1QBIbtie3r+SUzKe7UmkVgM

cXs5rqTMnyONSH4+JoxwvbUiM5xCN6gGVqPHyxPD1Rg/Dpk1Kmctnrz/umXuynzA0HVz3ZvSGei2ZzHEEod6EQ6sncv0m283tAOsAn6r5Ro=

属性描述默认可用性
maxAge设置 Cache-Control 标头的 max-age 属性(以毫秒为单位)或 ms 格式 中的字符串0
root相对文件名的根目录。
lastModifiedLast-Modified 标头设置为操作系统上文件的最后修改日期。设置 false 以禁用它。启用4.9.0+
headers包含与文件一起服务的 HTTP 标头的对象。
dotfiles提供点文件的选项。可能的值为 "allow"、"deny"、"ignore"。"ignore" 
acceptRanges启用或禁用接受范围请求。true4.14+
cacheControl启用或禁用设置 Cache-Control 响应标头。true4.14+
immutableCache-Control 响应标头中启用或禁用 immutable 指令。如果启用,还应指定 maxAge 选项以启用缓存。immutable 指令将阻止受支持的客户端在 maxAge 选项的生命周期内发出条件请求以检查文件是否已更改。false4.16+

K2Yh51UcMHYyy5d7aX6TeHlzcTxsWHBNXRWApGWwgA77l6RS/pGtbDYSJ5pyOS3xZP5mHPEXE5zIJdDui7h04LXNwr881ezHULuzFoK7/nXy8ez+WpyZgAqjIKzYiWBy+J9kOBjtjUPvTaHQkx8ds/sTN0ubkl49Kb+aWFbUb0bMLXeaL4w2WZX2uXGl1cl8q2uibfNNY1pxxFpxEa/TWqEj/4h0FXw3YJu6b18PnxLXtuuHnyEZWqINritLKpE0Q7Af8Ad02PbD1TQ9dvsybWn4aT2493hhUT4v3sO9Y8EKozZJAO1gQGntFPfKK2UCP5d05K2YTqmVN3nhOauCwQ==

ttUkGpGJ+MdB7bl9y9L7PayLb8zTuDGTDVJCW/XSB3usSSMVh1LRHmlAAOR5tFXiDCDPpcouQFUnU3P/ZkmVOPuykBxFh4+kChzdMpSuRDM=

app.get('/file/:name', (req, res, next) => {
  const options = {
    root: path.join(__dirname, 'public'),
    dotfiles: 'deny',
    headers: {
      'x-timestamp': Date.now(),
      'x-sent': true
    }
  }

  const fileName = req.params.name
  res.sendFile(fileName, options, (err) => {
    if (err) {
      next(err)
    } else {
      console.log('Sent:', fileName)
    }
  })
})

7Bmxc9EC7ki/tO/gSR0o035CZ5ld7fbn2I2BzWbU889dAtbiVgYzn0KOh9mo7CryI3RaanPtaswDrMnti5ezajy2NTaeSTSY3AqiFYYLbT/WWspRnj4b+8Z3Ur2KS2kG

app.get('/user/:uid/photos/:file', (req, res) => {
  const uid = req.params.uid
  const file = req.params.file

  req.user.mayViewFilesFrom(uid, (yes) => {
    if (yes) {
      res.sendFile(`/uploads/${uid}/${file}`)
    } else {
      res.status(403).send("Sorry! You can't see that.")
    }
  })
})

i5mH/polGS/9PLtgcrAy2vyzhQztu97ADJUyNEshuw3pSP9tk3OqdCBesgaJAdHl54nkjZ86A59NebvjLMuHwtPXOTsGspqhq9sKjV0LcfmVs41gMuCJBH7PJ5Xuje0y0FtwHZdq2S+JehbY+GNidTvHX9z9OzzErliAdYZnjB4=

res.sendStatus(statusCode)

jmE7gSvXKjAIRCWxkboqotsHfkruZtzT9zjPj3u4sHsn67TaYuFTrvvxyhQCBN3m79qyuLDjYxplR1WUjFFkYdGgSKWYUn5AmmE3Lqe0ZdFHWgBFo4D5qBursHw6oxBB1NgIiHjGBW81A7YP8SEmQhg+GAlOl+MdDtTX0rtyux62+tD86bZp0zIjpQiNFg07sfF3hH7kuP65uRHwd1ukxIJGTlG+Q+PD1QaTjtF52cEOFYzKwunmfD/VwNiMs0IkqG3hc85qzIjdMwrDhOzacA==

res.sendStatus(404)

B0Z+ZFUVa7uN+/hFBU2zjtETE1A1v/3Xh7Lsziz+sD1crHgapV4u77wKrAUwdDVwuXww1IykgJdJXgX5vAgEh+V51B3IVfLNbl6q9K00y6cWX2Hhqp1Kc1xQ1weqfshswdot8G0nKJGcdr/WHi3Fr1OilYVL5EcjvqFeuci+FYkkADOibDcfvdHkN+aHO/2cKX5rDDJfsPwza+NPVvkoEfgdFXgz0RZJKhaeaMKfyNCA/M69AUqsRDqkRb0hukRT7fWRTjra7YGtYGPdqugWdc0bvQjwyibZKjkYHnz/z3repsb3NTAtON8q7jRGaNEszW9S0XyW86US2PPs03u2Fw==

hgUSyBtBth3GQMiOfwNIoZsG/hggEyY3AgfHrf2vKp8L9MZrw4vwcvCnt6ygIaGyV0IpkT4ZVT3dG5OR7JJGWVPI2BeRFyPZY4DFs6TQP5I=

res.set(field [, value])

YJDX58khpFCoO9iN7zyle6wRXMn6LjcuVsT38qarnOSWBHajA+g16gHW+jPkQcx01+nw9g1Fk+NO3ljIxLDf6beT9//vndTEt2fnWx9sGpjRz9pJEhm6IzlR3oahMJ1IpFslhwYtaLKaQyl/gWdVtXfm4QAq601JHiE4aUYn5H0/DiBltLzD4tAv4KBS76t4

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

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

wRyUjsLDVE8WOzo7+RSrXCXoHHEPpsRxphvAjLjoU7kXMD3eMHN7fau31/UVXXiMCzjjha43sLxXDrRP5kFW3A==

res.status(code)

GZ8SW0GQQRrtWS6ALE+iOexMArzYn53Px2h4AeD3lHMd5O1OSGUXc1WjBAA17hRpMkUrz47yCZsp9eZWu/f1eivDtLwOTyJRZaS3FJLk+DtF+uhR9qW+2hr9blZxIMgkO2QlDo3f7nnwCjwAPwK/pgUi0WtIUTEb0iekWr++ZhLCQhbpAFifWRKmWmRhfLDc

res.status(403).end()
res.status(400).send('Bad Request')
res.status(404).sendFile('/absolute/path/to/404.png')

res.type(type)

JCmjc4eLu/yaBmf5PZgpIYdbzfrugF2icuQRLFZMRTkVTXDhja7pRrD6pdb8UioGphBp3zAFAp6arRxleQROxzfSupvhq30wi7yewwUeGFoqiV2CA2sVWLSdXhCETqwH37PbeRwG1QwWWJpkgKyjO3M0o2coGcB0MeTknJVDS9TyB2RBiNB5VEEuoy9gEHe6ehGafEx0a33YA2SeVOjmvKBkhIrKqW56KKNvXd0C/D76Sl376ePV5F33CZEg7aUzDsa5NV7c9pJaiMwOrdutBEzYz5q0fc/jvFdpkuoKllmY2Mm7AAb/PkCsI4KitjGHsC7hwdkBDtpHL5KG8e8d/ssd5OdLk0NVDzWbEejRKQkSjm2vxlta4MuiEQBB2w5cB8P64tCRPMHcrhFKR/giZIgeLnGo8KFUH6iAFW9txj+HjlKTV6a36lz639SwbqURqXuDP3vZbhilj3M0W3QVwA==

res.type('.html') // => 'text/html'
res.type('html') // => 'text/html'
res.type('json') // => 'application/json'
res.type('application/json') // => 'application/json'
res.type('png') // => image/png:

res.vary(field)

WJPBjFJWwv1dYFHR4ZUrsBTW4axxnSpWPYBjGItWBX3rOQrlrYS08G/pJ6d02yA/vv7AkuIvEHLoPUgZzyNY/VghHSF/DFEoit3f2/yfAcs=

res.vary('User-Agent').render('docs')