- Notifications
You must be signed in to change notification settings - Fork5
Open
Description
I am trying to add a default value to an optional parameter, butJoi.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 withreq.body or this is not supported, is it?
Thanks in advance.