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 schema to shot #71

Merged
merged 3 commits into from Aug 26, 2016
Merged

add validation schema to shot #71

merged 3 commits into from Aug 26, 2016

Conversation

johnbrett
Copy link
Contributor

Fixes #66

dispatchFunc: dispatchFunc,
options: options,
callback: callback
}, Schema);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ options, callback } looks nicer

url: internals.url.required(),
headers: Joi.object(),
payload: Joi.any(),
simulate: Joi.object(), // add these
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Add these... :-)

@hueniverse
Copy link
Contributor

Going to finish it?

@johnbrett
Copy link
Contributor Author

Cheers for the reminder @hueniverse - added the simulate options.

@hueniverse hueniverse merged commit 4d63193 into hapijs:master Aug 26, 2016
@hueniverse hueniverse added the feature New functionality or improvement label Aug 26, 2016
@hueniverse hueniverse added this to the 3.2.1 milestone Aug 26, 2016
@hueniverse hueniverse self-assigned this Aug 26, 2016
@hueniverse
Copy link
Contributor

Hmm. Now that I think about it, this will make things very slow when inject() is used in live code (e.g. not in tests). Will need a way to bypass it. I'll add something tomorrow.

@johnbrett
Copy link
Contributor Author

Yeah true, kind of the opposite direction to hapijs/hapi#2751 (Optimize server.inject() for runtime usage).

Could only run validate when NODE_ENV !== 'production' or something along those lines?

@antony
Copy link

antony commented Aug 26, 2016

NODE_ENV !== 'production' won't work. You'd want this validation disabled in perf testing environments too, and we have a different NODE_ENV variable for every region we are deployed in :)

Just needs a config variable or some sort of server.app attribute or similar.

@mtharrison
Copy link
Contributor

Agreed - I wouldn't ever want nes requests to pass through this validation step. An inject() option should do it.

@lock
Copy link

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.

Make shot validate options passed to it using JOI
4 participants