Guides  ›  Response  ›  Headers ← PREV NEXT →

Headers

Set headers on state.res before returning.

module.exports = {
  paths: '/text',
  handler: function (state) {
    state.res.setHeader('content-type', 'text/plain; charset=utf-8')
    state.res.setHeader('cache-control', 'no-store')
    return 'Hello world!'
  }
}

An explicit content type takes precedence over the server's default.

Next: Empty responses →

Tools for business systems.