2016-11-08 170 views
0

我正在執行一個put操作,它在rest客戶端中的工作很好,我得到了如下圖所示的pgi頭文件。如何從SAPUI5中的HTTP響應中獲取自定義標頭?

click here to open image

現在,我嘗試用更新方法從sapui5 odatamodel得到相同。 以下是我的代碼。

oModel.update("/performpgi(Srno='241')", {"Srno":"241"}, null,         
    function(oData, oResponse) { 
    console.log(oResponse.headers.pgi) //undefined 
    }, function(err) {}); 

在響應頭文件中,我沒有找到任何pgi變量。

任何人都可以幫助我嗎?

謝謝。

+0

console.log是否輸出任何內容? –

+0

它給出了undefined –

+0

如何檢查F12中的oResponse。那也沒有定義? –

回答

0
var fnFunction = function(oEvent){ 
//oEvent has your complete response, headers and so on 
//So you can do whatever you want to do. 
//please note that this is called on failure so just handle based on response code 
}; 

oModel.attachRequestCompleted(oData?, fnFunction, oListener?); 
+0

我試過oModel.attachRequestCompleted(function(event){console.log(event)}),但它沒有被激發。 –

+0

有關該問題的任何更新? –

+0

對不起Ashutosh,沒有更新。根據文檔,這必須工作:|如果你有jsfiddle/jsbin。我可以調試。 解決方法將包括響應正文本身。 –

相關問題