Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 028a98c

Browse files
dignifiedquiredaviddias
authored andcommitted
feat(http-api): add joi validation to bootstrap
1 parent 8509199 commit 028a98c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/http-api/routes/bootstrap.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const Joi = require('joi')
34
const resources = require('./../resources')
45

56
module.exports = (server) => {
@@ -20,7 +21,14 @@ module.exports = (server) => {
2021
pre: [
2122
{ method: resources.bootstrap.add.parseArgs, assign: 'args' }
2223
],
23-
handler: resources.bootstrap.add.handler
24+
handler: resources.bootstrap.add.handler,
25+
validate: {
26+
query: {
27+
arg: Joi.string().required(),
28+
default: Joi.boolean(),
29+
'stream-channels': Joi.boolean()
30+
}
31+
}
2432
}
2533
})
2634

@@ -39,7 +47,14 @@ module.exports = (server) => {
3947
pre: [
4048
{ method: resources.bootstrap.rm.parseArgs, assign: 'args' }
4149
],
42-
handler: resources.bootstrap.rm.handler
50+
handler: resources.bootstrap.rm.handler,
51+
validate: {
52+
query: {
53+
arg: Joi.string().required(),
54+
default: Joi.boolean(),
55+
'stream-channels': Joi.boolean()
56+
}
57+
}
4358
}
4459
})
4560
}

0 commit comments

Comments
 (0)