Skip to content
New issue

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

No Payload Validation #2392

arb opened this issue Feb 5, 2015 · 1 comment

No Payload Validation #2392

arb opened this issue Feb 5, 2015 · 1 comment
bug Bug or defect


Copy link

arb commented Feb 5, 2015

Unless I'm misreading the docs, the code below should validate that 204 status code responses should not have a payload.

    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 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.

Copy link

Marsup commented Feb 5, 2015

Probably because of

return (rule === false ? Joi.object({})

@hueniverse hueniverse added the bug Bug or defect label Feb 7, 2015
@hueniverse hueniverse self-assigned this Feb 9, 2015
@hueniverse hueniverse added this to the 8.2.0 milestone Feb 9, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
bug Bug or defect
None yet

No branches or pull requests

3 participants