Hi There,
Good day !I am working on a NEO to CF migration project.
Info: In CF scenario we have oData provisioning since multiple destinations.
Issue:
- Existing app with file upload functionality have the regular approach of
- oModel.refreshSecurityToken(); to fetch x-csrf-token
- And oModel.getHeaders()["x-csrf-token"] to retrieve the token, which is then passed as header field.
- When I do oModel.refreshSecurityToken(); in network call request headers I can see x-csrf-token: Fetch, but in response headers I don't see the parameter x-csrf-token
- When I try to retrieve the same by oModel.getHeaders()["x-csrf-token"] its undefined.
Can you please advise what am I doing wrong,
Data source definition is manifest.json:
"commonService": {
"uri": "/sap/opu/odata/sap/XXXXXXX_srv/",
"type": "OData",
"settings": {
"annotations": [],
"localUri": "localService/commonService/metadata.xml",
"odataVersion": "2.0"
}
}
Model Definition in Manifest.json
"common": {
"dataSource": "commonService",
"preload": true,
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"useBatch": true,
"defaultBindingMode": "TwoWay",
"defaultCountMode": "Inline",
"defaultUpdateMethod": "PUT"
}
}
UploadSetwithTable method beforeUploadStarts (part of the code)
var oModel = this.getView().getModel("common");
oModel.refreshSecurityToken();
this.uploadAttachments.addHeaderField(new CoreItem({
key: "x-csrf-token",
text: oModel.getHeaders()["x-csrf-token"]
}));
Can you please advise, as I couldn't understand what am I doing wrong, or is there a different approach since oData Provisoning unlike direct backend destination connection.
Thank you in Advance,
Sai