We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I had a second look at it seems we have bugs in that part, before you even touched it.
under-pressure/index.js
Line 107 in 26677ab
When opts.exposeStatusRoute.routeSchemaOpts is in Object.assign before our changes, than it means we can not overwrite the error statuscodes.
opts.exposeStatusRoute.routeSchemaOpts
The same here:
Line 113 in 26677ab
We could set a custom error handler like this:
fastify.setErrorHandler((err, request, reply, done) => { reply.status(err.statusCode) .send({ code: err.code, message: err.message }) done() })
a potential unit test would be:
test('check error handler', async t => { t.plan(1) const fastify = Fastify({ exposeStatusRoute: true }) fastify.register(underPressure, { healthCheck: () => { throw new Error('Arbitrary Error') }, exposeStatusRoute: { routeOpts: { logLevel: 'silent' } } }) t.equal((await fastify.inject().get('/').end()).body, '{"code":"FST_UNDER_PRESSURE","message":"Service Unavailable"}') })
Originally posted by @Uzlopak in #198 (comment)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
under-pressure/index.js
Line 107 in 26677ab
When
opts.exposeStatusRoute.routeSchemaOpts
is in Object.assign before our changes, than it means we can not overwrite the error statuscodes.The same here:
under-pressure/index.js
Line 113 in 26677ab
We could set a custom error handler like this:
a potential unit test would be:
Originally posted by @Uzlopak in #198 (comment)
The text was updated successfully, but these errors were encountered: