custom-parser.1.test.js — fastify Source File
Architecture documentation for custom-parser.1.test.js, a javascript file in the fastify codebase.
Entity Profile
Source Code
'use strict'
const { test } = require('node:test')
const Fastify = require('../fastify')
const jsonParser = require('fast-json-body')
process.removeAllListeners('warning')
test('Should have typeof body object with no custom parser defined, null body and content type = \'text/plain\'', async (t) => {
t.plan(3)
const fastify = Fastify()
fastify.post('/', (req, reply) => {
reply.send(req.body)
})
const fastifyServer = await fastify.listen({ port: 0 })
t.after(() => fastify.close())
const result = await fetch(fastifyServer, {
method: 'POST',
body: null,
headers: {
'Content-Type': 'text/plain'
}
})
t.assert.ok(result.ok)
t.assert.strictEqual(result.status, 200)
t.assert.strictEqual(await result.text(), '')
})
test('Should have typeof body object with no custom parser defined, undefined body and content type = \'text/plain\'', async (t) => {
t.plan(3)
const fastify = Fastify()
fastify.post('/', (req, reply) => {
reply.send(req.body)
})
const fastifyServer = await fastify.listen({ port: 0 })
t.after(() => fastify.close())
const result = await fetch(fastifyServer, {
method: 'POST',
body: undefined,
headers: {
'Content-Type': 'text/plain'
}
})
t.assert.ok(result.ok)
t.assert.strictEqual(result.status, 200)
t.assert.strictEqual(await result.text(), '')
})
test('Should get the body as string /1', async (t) => {
t.plan(4)
const fastify = Fastify()
// ... (207 more lines)
Source
Frequently Asked Questions
What does custom-parser.1.test.js do?
custom-parser.1.test.js is a source file in the fastify codebase, written in javascript.
Where is custom-parser.1.test.js in the architecture?
custom-parser.1.test.js is located at test/custom-parser.1.test.js (directory: test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free