arb / celebrate

A joi validation middleware for Express.
MIT License
1.33k stars 66 forks source link

Validate body which is coming in multipart/form-data #214

Closed jay-edx closed 3 years ago

jay-edx commented 3 years ago

Hello, I'm passing body in form-data as I need to pass a file as well (file is optional). If I don't pass the file and when i apply the middle ware for validating the body using celebrate, It's not working.

Here is my code:

VOTER_CREATE: celebrate({
        body: Joi.object({
            firstName: Joi.string().required()
        })
            })
arb commented 3 years ago

You're going to need to show more than that. I don't have enough code to get an idea of what you're doing or what might be wrong.

arb commented 3 years ago

Closing due to inactivity.