From 028a98c50037d75a7f2a2bc9a127ef489471730e Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Fri, 30 Sep 2016 10:59:48 +0200 Subject: [PATCH] feat(http-api): add joi validation to bootstrap --- src/http-api/routes/bootstrap.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/http-api/routes/bootstrap.js b/src/http-api/routes/bootstrap.js index d4ac0d37d4..8f1c46af42 100644 --- a/src/http-api/routes/bootstrap.js +++ b/src/http-api/routes/bootstrap.js @@ -1,5 +1,6 @@ 'use strict' +const Joi = require('joi') const resources = require('./../resources') module.exports = (server) => { @@ -20,7 +21,14 @@ module.exports = (server) => { pre: [ { method: resources.bootstrap.add.parseArgs, assign: 'args' } ], - handler: resources.bootstrap.add.handler + handler: resources.bootstrap.add.handler, + validate: { + query: { + arg: Joi.string().required(), + default: Joi.boolean(), + 'stream-channels': Joi.boolean() + } + } } }) @@ -39,7 +47,14 @@ module.exports = (server) => { pre: [ { method: resources.bootstrap.rm.parseArgs, assign: 'args' } ], - handler: resources.bootstrap.rm.handler + handler: resources.bootstrap.rm.handler, + validate: { + query: { + arg: Joi.string().required(), + default: Joi.boolean(), + 'stream-channels': Joi.boolean() + } + } } }) }