Skip to content

Commit b1ee61b

Browse files
committed
Fixed sync batch bug
1 parent 69a1604 commit b1ee61b

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/js/WebApiClient.Core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@
515515
if (parameters.isOverLengthGet) {
516516
response = response.batchResponses[0].payload;
517517
} else {
518-
return;
518+
return response;
519519
}
520520
}
521521

@@ -577,7 +577,7 @@
577577
for (var i = 0; i < params.alternateKey.length; i++) {
578578
var key = params.alternateKey[i];
579579
var value = key.value;
580-
580+
581581
if (typeof(key.value) !== "number") {
582582
value = "'" + key.value + "'";
583583
}

src/spec/WebApiClientSpec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,23 @@ describe("WebApiClient", function() {
17371737
expect(response.value.length).toBe(12);
17381738
});
17391739

1740+
it("should send batch sync", function(){
1741+
var fetchXml = "<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"false\"><entity name=\"account\"><attribute name=\"name\" /><order attribute=\"name\" descending=\"false\" /><filter type=\"and\"><condition attribute=\"name\" operator=\"like\" value=\"%\" /></filter></entity></fetch>";
1742+
var batch = new WebApiClient.Batch({
1743+
requests: [
1744+
WebApiClient.Retrieve({
1745+
entityName: "account",
1746+
fetchXml: fetchXml,
1747+
asBatch: true
1748+
})
1749+
],
1750+
async: false
1751+
});
1752+
1753+
var response = WebApiClient.SendBatch(batch);
1754+
expect(response.batchResponses[0].payload.value.length).toBe(12);
1755+
});
1756+
17401757
it("should update record and return", function(){
17411758
var response = WebApiClient.Update({entityName: "account", entityId: "00000000-0000-0000-0000-000000000001", entity: account, async: false});
17421759

0 commit comments

Comments
 (0)