Open chinmay9389 opened 10 months ago
bro please make sure that you user.model and the key that you are sending from postman as well as key that you are desctructuring from the req.body are same
just add (field) => field?.trim() === "" || typeof field === "undefined")
Where: if ( [fullName, email, username, password].some((field) => field?.trim() === "") ) { throw new ApiError(400, "All fields are required") } Expected behaviour -> When request body doesn't contain any of the field then it should throw error. Actual behaviour -> It is not able to catch the undefined field hence error is missing