Home / Function/ trailer() — fastify Function Reference

trailer() — fastify Function Reference

Architecture documentation for the trailer() function in reply.js from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  59b5093c_d8b5_b599_1c7c_b6b7c6258d22["trailer()"]
  4bcd71dc_1ec2_5fe8_b8ff_4a371e392925["reply.js"]
  59b5093c_d8b5_b599_1c7c_b6b7c6258d22 -->|defined in| 4bcd71dc_1ec2_5fe8_b8ff_4a371e392925
  style 59b5093c_d8b5_b599_1c7c_b6b7c6258d22 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/reply.js lines 289–300

Reply.prototype.trailer = function (key, fn) {
  key = key.toLowerCase()
  if (INVALID_TRAILERS.has(key)) {
    throw new FST_ERR_BAD_TRAILER_NAME(key)
  }
  if (typeof fn !== 'function') {
    throw new FST_ERR_BAD_TRAILER_VALUE(key, typeof fn)
  }
  if (this[kReplyTrailers] === null) this[kReplyTrailers] = {}
  this[kReplyTrailers][key] = fn
  return this
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does trailer() do?
trailer() is a function in the fastify codebase, defined in lib/reply.js.
Where is trailer() defined?
trailer() is defined in lib/reply.js at line 289.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free