You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
485 B

4 years ago
'use strict'
const t = require('tap')
const Fastify = require('..')
const fastify = Fastify()
fastify.route({
method: 'POST',
path: '/jsonBody',
handler: function (req, reply) {
throw new Error('kaboom')
}
})
const reqOpts = {
method: 'POST',
url: '/jsonBody',
payload: {
hello: 'world'
}
}
process.on('uncaughtException', (err) => {
t.equal(err.message, 'kaboom')
})
fastify.inject(reqOpts, (e, res) => {
t.plan(1)
t.fail('should not be called')
})