const json = `[ { "id": 1000, "name": "order 1", "load1": "value load row 1:1", "load2": "value load row 1:2", "load3": "value load row 1:3" }, { "id": 1001, "name": "order 2", "load1": "value load row 2:1", "load2": "value load row 2:2", "load3": "value load row 2:3" } ]`; // check if json is valid JSON.parse(json) const json400Error=`[ { "sys": { "type": "Error", "message": "Invalid request" } } ]` // check if json is valid JSON.parse(json400Error) const json200Error=`[ { "sys": { "type": "Error", "message": "Invalid request" } } ]` // check if json is valid JSON.parse(json200Error) const html = ` <label for="load1">field load 1</label><input id="load1" data-monster-attributes="value path:data.load1"> <label for="load2">field load 2</label><input id="load2" data-monster-attributes="value path:data.load2"> <label for="load3">field load 3</label><input id="load3" data-monster-attributes="value path:data.load3"> `; const requestDelay = 100 export default [ { url: '/issue-210.json', method: 'get', rawResponse: async (req, res) => { res.setHeader('Content-Type', 'application/json') res.statusCode = 200 setTimeout(function() { res.end(json) }, requestDelay); }, }, { url: '/issue-210', method: 'post', rawResponse: async (req, res) => { res.setHeader('Content-Type', 'application/json') res.statusCode = 400 setTimeout(function() { res.end(json400Error) }, requestDelay); }, }, { url: '/issue-210.html', method: 'get', rawResponse: async (req, res) => { res.setHeader('Content-Type', 'text/html') res.statusCode = 200 setTimeout(function() { res.end(html) }, 4000); }, } ];