Releases: codecoolture/next-joi
Releases · codecoolture/next-joi
v2.2.1
v2.2.0
✨ New
The onValidationError
function will now receive the validation error coming from Joi as a third parameter!
import withJoi from "next-joi";
export default withJoi({
onValidationError: (req, res, error) => {
return res.status(400).end();
},
});
v2.1.1
This is just @sergioalvz fighting against the NPM registry 😄
v2.1.0
✨ New
The validation function has now support to check the headers
property from the incoming request!
import Joi from "joi";
import withJoi from "next-joi";
const validate = withJoi({
onValidationError: (_, res) => {
return res.status(400).end();
},
});
export default validate(
{
headers: Joi.object({
"accept-language": Joi.string().valid("en"),
}).unknown(),
},
(req, res) => {
// This function will be only executed if the incoming request complies
// with the validation schema defined above.
}
);
v2.1.0
✨ New
The validation function has now support to check the headers
property from the incoming request!
import Joi from "joi";
import withJoi from "next-joi";
const validate = withJoi({
onValidationError: (_, res) => {
return res.status(400).end();
},
});
export default validate(
{
headers: Joi.object({
"accept-language": Joi.string().valid("en"),
}).unknown(),
},
(req, res) => {
// This function will be only executed if the incoming request complies
// with the validation schema defined above.
}
);
v2.0.0
Breaking Changes
This version includes breaking changes. The default export is now a factory function that can be configured to have custom error handling for validation errors. The README.md
has been updated accordingly to reflect the new behavior.
import withJoi from "next-joi";
export default withJoi({
onValidationError: (_, res) => {
return res.status(400).end();
},
});
v1.0.0
Public release :rocket: