angular-soap icon indicating copy to clipboard operation
angular-soap copied to clipboard

Differences in array return vs singular item

Open ericfernance opened this issue 8 years ago • 0 comments

@andrewmcgivery right. So one thing I have discovered is that when returning a singular the soapclient puts the result inside the data.item property and when returning an array it's an array.

easier to explain with code.

   var $soap = this.$injector.get("$soap");
   $soap.post(endpoint, "method_name", {})
            .then(function (data) {
             if (typeof (data.item) !== "undefined") {
                // There's only 1 version!
                versions = [data.item];
            }
            else {
                versions = data;
            }

I'm not sure if it's better documenting this different in behaviour between array results and singular results or standardising the result in the angular-soap wrapper?

Eric.

ericfernance avatar Mar 31 '16 03:03 ericfernance