mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Fix typo in custom validator
This commit is contained in:
		
							parent
							
								
									37f9ed9570
								
							
						
					
					
						commit
						089268825f
					
				@ -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