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

Fix option parsing to match hapi documentation #16

merged 1 commit into from Dec 5, 2014


Copy link

kanongil commented Dec 5, 2014

Allow function param in path, and convert lookupCompressed stringified booleans to actual booleans.

@kanongil kanongil added the bug label Dec 5, 2014
@@ -30,7 +30,7 @@ internals.schema = Joi.alternatives([
exports.handler = function (route, options) {

Joi.assert(options, internals.schema, 'Invalid file handler options (' + route.path + ')');
var settings = (typeof options !== 'object' ? { path: options } : Hoek.clone(options)); // options can be reused
var settings = (typeof options !== 'object' ? { path: options } : Joi.validate(options, internals.schema).value);

This comment has been minimized.

Copy link

hueniverse Dec 5, 2014


I would comment that no cloning needed because the config is all literals. But if at some point you add an unvalidated object to the schema, it will be shallow copied which will be a problem without a clone. So worth noting it.

hueniverse added a commit that referenced this pull request Dec 5, 2014
Fix option parsing to match hapi documentation
@hueniverse hueniverse merged commit 9ee41cc into hapijs:master Dec 5, 2014
1 check passed
1 check passed
continuous-integration/travis-ci The Travis CI build passed
@hueniverse hueniverse self-assigned this Dec 5, 2014
@hueniverse hueniverse added this to the 2.0.0 milestone Dec 5, 2014
@kanongil kanongil deleted the kanongil:file-options-fix branch Dec 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.