Validate request parameters

This commit is contained in:
Daniel Lugo 2022-01-17 16:07:58 -04:00
parent add3fea6fa
commit de4978a854

View file

@ -1899,6 +1899,12 @@ module.exports = async (
app.get('/api/lnd/transactions', (req, res) => { app.get('/api/lnd/transactions', (req, res) => {
const { lightning } = LightningServices.services const { lightning } = LightningServices.services
const { page, paginate = true, itemsPerPage } = req.query const { page, paginate = true, itemsPerPage } = req.query
if (typeof page !== 'number') {
throw new TypeError('page is not a number')
}
if (typeof itemsPerPage !== 'number') {
throw new TypeError('itemsPerPage is not a number')
}
lightning.getTransactions({}, (err, { transactions = [] } = {}) => { lightning.getTransactions({}, (err, { transactions = [] } = {}) => {
if (err) { if (err) {
return handleError(res, err) return handleError(res, err)