-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I am trying to add a default value to an optional parameter, but Joi.default() doesn't seem to take effect.
My code looks somehow like this:
const params = Joi.object({
language: Joi.string().default('en-us')
})
export default validate({ body: params }, async (req, res) => {
console.log(req.body.language) // outputs undefined if not passed
})
I'm guessing either I shouldn't access body with req.body or this is not supported, is it?
Thanks in advance.
wdzeng
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request