Unless I'm misreading the docs, the code below should validate that 204 status code responses should not have a payload.
server.route({
method: 'GET',
path: '/',
config: {
response: {
status: {
204: false
}
},
handler: function (request, reply) { reply().code(204); }
}
});
However, if you make a request to "/" you get an error
Debug: internal, implementation, error
Error: value must be an object
Is this intentional or a bug? Tracing the code, it looks like a Joi validation schema is created https://github.com/hapijs/hapi/blob/master/lib/route.js#L101-L106 with the value of false which turns into an empty object and then that makes 204 responses required to be an object, instead of nothing.
Unless I'm misreading the docs, the code below should validate that 204 status code responses should not have a payload.
However, if you make a request to "/" you get an error
Debug: internal, implementation, error Error: value must be an objectIs this intentional or a bug? Tracing the code, it looks like a Joi validation schema is created https://github.com/hapijs/hapi/blob/master/lib/route.js#L101-L106 with the value of
falsewhich turns into an empty object and then that makes 204 responses required to be an object, instead of nothing.