add try/catch block around JSON.parse, since user input can be incorrect formatted string

This commit is contained in:
Maurits Lourens 2021-08-03 22:53:18 +02:00
parent 3029178eeb
commit 81b4f8f5d4
1 changed files with 6 additions and 1 deletions

View File

@ -92,7 +92,12 @@ module.exports.run = async function ({ inputs }) {
}
if (headers && headers.length !== 0) {
request.headers = { ...request.headers, ...JSON.parse(headers) }
try {
const customHeaders = JSON.parse(headers)
request.headers = { ...request.headers, ...customHeaders }
} catch (err) {
console.error(err)
}
}
}