mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
Fix typo in custom validator
This commit is contained in:
parent
9fdb948c69
commit
8c02cc4949
@ -5,7 +5,7 @@ const validator = require('express-validator');
|
|||||||
module.exports = function() {
|
module.exports = function() {
|
||||||
return validator({
|
return validator({
|
||||||
customValidators: {
|
customValidators: {
|
||||||
isUrlFirendlyName: input => encodeURIComponent(input) === input,
|
isUrlFriendlyName: input => encodeURIComponent(input) === input,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -108,7 +108,7 @@ module.exports.router = function(config) {
|
|||||||
|
|
||||||
router.post('/validate', (req, res) => {
|
router.post('/validate', (req, res) => {
|
||||||
req.checkBody('name', 'Name is required').notEmpty();
|
req.checkBody('name', 'Name is required').notEmpty();
|
||||||
req.checkBody('name', 'Name must be URL friendly').isUrlFirendlyName();
|
req.checkBody('name', 'Name must be URL friendly').isUrlFriendlyName();
|
||||||
|
|
||||||
validateRequest(req)
|
validateRequest(req)
|
||||||
.then(validateUniqueName)
|
.then(validateUniqueName)
|
||||||
@ -118,7 +118,7 @@ module.exports.router = function(config) {
|
|||||||
|
|
||||||
router.post('/', (req, res) => {
|
router.post('/', (req, res) => {
|
||||||
req.checkBody('name', 'Name is required').notEmpty();
|
req.checkBody('name', 'Name is required').notEmpty();
|
||||||
req.checkBody('name', 'Name must be URL friendly').isUrlFirendlyName();
|
req.checkBody('name', 'Name must be URL friendly').isUrlFriendlyName();
|
||||||
|
|
||||||
const userName = extractUser(req);
|
const userName = extractUser(req);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user