1 | 'use strict'
|
2 |
|
3 | const t = require('tap')
|
4 | const Fastify = require('..')
|
5 | const fastify = Fastify()
|
6 |
|
7 | fastify.route({
|
8 | method: 'POST',
|
9 | path: '/jsonBody',
|
10 | handler: function (req, reply) {
|
11 | throw new Error('kaboom')
|
12 | }
|
13 | })
|
14 |
|
15 | const reqOpts = {
|
16 | method: 'POST',
|
17 | url: '/jsonBody',
|
18 | payload: {
|
19 | hello: 'world'
|
20 | }
|
21 | }
|
22 |
|
23 | process.on('uncaughtException', (err) => {
|
24 | t.equal(err.message, 'kaboom')
|
25 | })
|
26 |
|
27 | fastify.inject(reqOpts, (e, res) => {
|
28 | t.plan(1)
|
29 | t.fail('should not be called')
|
30 | })
|