headRouteOnSendHandler() — fastify Function Reference
Architecture documentation for the headRouteOnSendHandler() function in head-route.js from the fastify codebase.
Entity Profile
Dependency Diagram
graph TD eb3ef7fb_2278_d4d5_26a3_22f1829a5231["headRouteOnSendHandler()"] c5facddc_8288_c141_71d8_5c9489d349b1["head-route.js"] eb3ef7fb_2278_d4d5_26a3_22f1829a5231 -->|defined in| c5facddc_8288_c141_71d8_5c9489d349b1 style eb3ef7fb_2278_d4d5_26a3_22f1829a5231 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
lib/head-route.js lines 2–34
function headRouteOnSendHandler (req, reply, payload, done) {
// If payload is undefined
if (payload === undefined) {
reply.header('content-length', '0')
done(null, null)
return
}
// node:stream
if (typeof payload.resume === 'function') {
payload.on('error', (err) => {
reply.log.error({ err }, 'Error on Stream found for HEAD route')
})
payload.resume()
done(null, null)
return
}
// node:stream/web
if (typeof payload.getReader === 'function') {
payload.cancel('Stream cancelled by HEAD route').catch((err) => {
reply.log.error({ err }, 'Error on Stream found for HEAD route')
})
done(null, null)
return
}
const size = '' + Buffer.byteLength(payload)
reply.header('content-length', size)
done(null, null)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does headRouteOnSendHandler() do?
headRouteOnSendHandler() is a function in the fastify codebase, defined in lib/head-route.js.
Where is headRouteOnSendHandler() defined?
headRouteOnSendHandler() is defined in lib/head-route.js at line 2.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free