I've spent a couple of hours trying to find out why I only get one row out of many in backend.
The backend is easy enough, it just returns 5 mock JSON objects.
Here is my code to call the IBM MobileFirst platform 8 adapter:
var request = new WLResourceRequest("/adapters/WorkOrder/getList", WLResourceRequest.GET);
request.send().then((response)=> {
console.log("data loaded from adapter: " + JSON.stringify(response.responseJSON), response);
console.log("Response object: " + JSON.stringify(response));
this.data=response.responseJSON;
},
(error)=> {
console.log("Failed to load data: " + JSON.stringify(error), error);
});
The resulting response.responseText is:
"responseText":"[{\"enddate\":\"2017-03-03\",\"description\":\"Test work order 0\",\"id\":1,\"ts\":\"Ban\",\"status\":\"In progress\"},{\"enddate\":\"2017-03-03\",\"description\":\"Test work order 1\",\"id\":2,\"ts\":\"Ban\",\"status\":\"In progress\"},{\"enddate\":\"2017-03-03\",\"description\":\"Test work order 2\",\"id\":3,\"ts\":\"Ban\",\"status\":\"In progress\"},{\"enddate\":\"2017-03-03\",\"description\":\"Test work order 3\",\"id\":4,\"ts\":\"Ban\",\"status\":\"In progress\"},{\"enddate\":\"2017-03-03\",\"description\":\"Test work order 4\",\"id\":5,\"ts\":\"Ban\",\"status\":\"In progress\"}]"
The resulting response.responseJSON is:
"responseJSON":{"enddate":"2017-03-03","description":"Test work order 0","id":1,"ts":"Ban","status":"In progress"}
Why doesn't responseJSON contain the same array as responseText?