返回消息:“;”,statusText:在使用angular的breeze odata查询中“OK”

时间:2014-10-29 02:21:15

标签: angularjs odata breeze

我是breeze和odata的新手。

我试图用角度微风从odata api中获取数据......

继承我的代码:

//adding authorization to the header
        var authObj = localStorageService.get('authorizationData');
        var token = 'Bearer ' + authObj.token;
        var oldClient = OData.defaultHttpClient;

        var myClient = {
            request: function (request, success, error) {
                request.headers.Authorization = token;
                return oldClient.request(request, success, error);
            }
        };

        OData.defaultHttpClient = myClient;

        baseService.getBreezeAdapter;

        breeze.NamingConvention.camelCase.setAsDefault();
        var manager = baseService.newManager();

        var query = new breeze.EntityQuery()
                        .from('Customers');


        function fetchData() {
            manager.executeQuery(query)
                .then(function (data) {
                    console.log(data)
                })
                .catch(function (fail) {
                    console.log(fail)
                })
                .finally(function (response) {

                });
        };

当我看到小提琴手时...没有错误..工作正常..

但是在查询之后,它会陷入失败的状态..它会返回一条错误消息 “;”,但它说statustext是好的,它的body元素中有数据..

这是实际错误

{message: "; ", statusText: "OK", status: 200, url: "http://xxxxxx.net/odata/Customers", body: Object…}

有人可以向我解释为什么它会返回错误“;”

0 个答案:

没有答案