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.
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:
I'm guessing either I shouldn't access body with
req.bodyor this is not supported, is it?Thanks in advance.