Home / File/ skip-reply-send.test.js — fastify Source File

skip-reply-send.test.js — fastify Source File

Architecture documentation for skip-reply-send.test.js, a javascript file in the fastify codebase.

Entity Profile

Relationship Graph

Source Code

'use strict'

const { test, describe } = require('node:test')
const split = require('split2')
const net = require('node:net')
const Fastify = require('../fastify')

process.removeAllListeners('warning')

const lifecycleHooks = [
  'onRequest',
  'preParsing',
  'preValidation',
  'preHandler',
  'preSerialization',
  'onSend',
  'onTimeout',
  'onResponse',
  'onError'
]

test('skip automatic reply.send() with reply.hijack and a body', async (t) => {
  const stream = split(JSON.parse)
  const app = Fastify({
    logger: {
      stream
    }
  })

  stream.on('data', (line) => {
    t.assert.notStrictEqual(line.level, 40) // there are no errors
    t.assert.notStrictEqual(line.level, 50) // there are no errors
  })

  app.get('/', (req, reply) => {
    reply.hijack()
    reply.raw.end('hello world')

    return Promise.resolve('this will be skipped')
  })

  await app.inject({
    method: 'GET',
    url: '/'
  }).then((res) => {
    t.assert.strictEqual(res.statusCode, 200)
    t.assert.strictEqual(res.body, 'hello world')
  })
})

test('skip automatic reply.send() with reply.hijack and no body', async (t) => {
  const stream = split(JSON.parse)
  const app = Fastify({
    logger: {
      stream
    }
  })

  stream.on('data', (line) => {
    t.assert.notStrictEqual(line.level, 40) // there are no error
// ... (258 more lines)

Domain

Subdomains

Frequently Asked Questions

What does skip-reply-send.test.js do?
skip-reply-send.test.js is a source file in the fastify codebase, written in javascript. It belongs to the CoreKernel domain, LifecycleManager subdomain.
What functions are defined in skip-reply-send.test.js?
skip-reply-send.test.js defines 1 function(s): testHandlerOrBeforeHandlerHook.
Where is skip-reply-send.test.js in the architecture?
skip-reply-send.test.js is located at test/skip-reply-send.test.js (domain: CoreKernel, subdomain: LifecycleManager, directory: test).

Analyze Your Own Codebase

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

Try Supermodel Free