const json = `{ "0": { "id": 1000, "field1": "dataset 1, value field 1", "field2": "dataset 1, value field 2", "field3": "dataset 1, value field 3" }, "1": { "id": 1001, "field1": "dataset 2, value field 1", "field2": "dataset 2, value field 2", "field3": "dataset 2, value field 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) export default [ { url: '/issue-217.json', method: 'get', rawResponse: async (req, res) => { res.setHeader('Content-Type', 'application/json') res.statusCode = 200 setTimeout(function() { res.end(json) }, 10); }, }, { url: '/issue-217', method: 'post', rawResponse: async (req, res) => { res.setHeader('Content-Type', 'application/json') res.statusCode = 400 setTimeout(function() { res.end(json400Error) }, 10); }, } ];