Skip to content

Add validation check for stripUnknown route response option#2972

Merged
hueniverse merged 2 commits intohapijs:masterfrom
johnbrett:master
Dec 22, 2015
Merged

Add validation check for stripUnknown route response option#2972
hueniverse merged 2 commits intohapijs:masterfrom
johnbrett:master

Conversation

@johnbrett
Copy link
Copy Markdown
Contributor

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 the feature New functionality or improvement label Dec 13, 2015
@hueniverse hueniverse added this to the 11.1.3 milestone Dec 13, 2015
@hueniverse hueniverse self-assigned this Dec 13, 2015
@hueniverse
Copy link
Copy Markdown
Contributor

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

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

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

feature New functionality or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants