UNPKG

522 BJavaScriptView Raw
1'use strict'
2
3const t = require('tap')
4const test = t.test
5const Fastify = require('../fastify')
6
7test('#2214 - wrong content-length', t => {
8 const fastify = Fastify()
9
10 fastify.get('/', async () => {
11 const error = new Error('MY_ERROR_MESSAGE')
12 error.headers = {
13 'content-length': 2
14 }
15 throw error
16 })
17
18 fastify.inject({
19 method: 'GET',
20 path: '/'
21 })
22 .then(response => {
23 t.strictEqual(response.headers['content-length'], '' + response.rawPayload.length)
24 t.end()
25 })
26})