简体   繁体   English

如何从SAPUI5中的HTTP响应中获取自定义标头?

[英]How to fetch custom header from HTTP response in SAPUI5?

I am performing a put operation and it is working great in rest client in response i get pgi header as shown in below image. 我正在执行put操作,它在rest client中工作得很好,作为响应,我得到pgi标头,如下图所示。

click here to open image 点击这里打开图片

Now, I try to get the same from sapui5 odatamodel using update method. 现在,我尝试使用更新方法从sapui5 odatamodel中获得相同的结果。 Following is my code. 以下是我的代码。

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

In the response headers I didn't find any pgi Variable. 在响应头中,我没有找到任何pgi变量。

Can any help me out with this? 有什么可以帮助我的吗?

Thanks. 谢谢。

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?);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM