diff --git a/lib/routes/bins/update.js b/lib/routes/bins/update.js index 387c83a0..ec71c2bb 100644 --- a/lib/routes/bins/update.js +++ b/lib/routes/bins/update.js @@ -4,20 +4,11 @@ const validate = require("har-validator"); module.exports = function (req, res, next) { const id = req.params.uuid; let mock = req.jsonBody; - - // check for full HAR - if (req.jsonBody?.response) { - mock = req.jsonBody.response; - } - - // exception for the web Form - // TODO eliminate this and rely on req.simple.postData.text - if (req.simple.postData.params?.response) { - try { - mock = JSON.parse(req.simple.postData.params.response); - } catch (e) { - debug(e); - } + if (!mock) { + res.body = { + errors: "Response HAR is required", + }; + next(); } // overritten by application/x-www-form-urlencoded or multipart/form-data