且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

BreezeJs,调用SaveChanges() - 未捕获类型错误:无法读取的未定义的属性'状态文本“

更新时间:2021-11-27 06:50:19

在最后,这被证明是的SAP NetWeaver网关的处理OData的一个怪癖。它发出了一个头,当它不应该,并且将内容ID头为内容id。

In the end this proves to be a quirk of SAP Netweaver Gateway handling the OData. It sends a header when it shouldn't, and sends the "Content-ID" header as content-id.

要修复这些我最后不得不行datajs1.1.1从

To fix these I ended up having to add lines to readBatch method in datajs1.1.1 from

if (response.statusCode >= 200 && response.statusCode <= 299) {
     partHandler(context.handlerContext).read(response,   context.handlerContext);
} else {
     // Keep track of failed responses and continue processing the batch.
     response = { message: "HTTP request failed", response: response };
}

if (response.statusCode >= 200 && response.statusCode <= 299) {
    if (response.statusCode != 204) 
        partHandler(context.handlerContext).read(response,   context.handlerContext);
} else {
     // Keep track of failed responses and continue processing the batch.
     response = { message: "HTTP request failed", response: response };
}

和改变从

var contentId = cr.headers["Content-ID"];

var contentId = cr.headers["content-id"];

这解决了这个问题,并确保响应正确处理。

This resolved the problem and ensured that the response was correctly dealt with.