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

Add validation check for stripUnknown route response option #2972

Merged
merged 2 commits into from Dec 22, 2015
Merged

Add validation check for stripUnknown route response option #2972

merged 2 commits into from Dec 22, 2015

Conversation

@johnbrett
Copy link
Contributor

@johnbrett johnbrett commented Dec 13, 2015

This might save someone some time debugging in the future. Currently we can add:

server.route({
    method: 'GET',
    path: '/',
    handler: function (request, reply) {

        return reply('ok');
    },
    config: {
        response: {
            schema: Joi.string(),
            options: {
                stripUnknown: true
            }
        }
    }
});

Which actually wouldn't strip any unknown keys without the modify key set true. With this PR if we add a route with response option stripUnknown set true without modify set to true, it will throw a validation error.

@hueniverse hueniverse added this to the 11.1.3 milestone Dec 13, 2015
@hueniverse hueniverse self-assigned this Dec 13, 2015
@hueniverse
Copy link
Contributor

@hueniverse hueniverse commented Dec 13, 2015

You made travis sad... Just remove the trailing spaces.

hueniverse added a commit that referenced this issue Dec 22, 2015
Add validation check for stripUnknown route response option
@hueniverse hueniverse merged commit 1bc42bc into hapijs:master Dec 22, 2015
1 check passed
hueniverse added a commit that referenced this issue Dec 27, 2015
@lock
Copy link

@lock lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants