使用SDK (@ SAP - Cloud -sdk/核心版本1.26.1,@sap/cloud-sdk service版本1.19.0),ODATA过滤器不会在URL查询部分编码百分比。
示例:(假设存在描述为"ä_description“的产品)
以下示例不检索此产品说明:
const term = 'ä_description';
const destination = getDestinationInformation(); //get destination information from somewhere
const results = await ProductDescription.requestBuilder()
.getAll()
.filter(ProductDescription.PRODUCT_DESCRIPTION.equals(term))
.execute(destination);
此片段生成以下请求URL:
"https://<host>/sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductDescription?$format=json&$filter=(ProductDescription eq 'ä_description')"
当对搜索项(const term = encodeURIComponent('ä_description');
)执行百分比编码时,将生成以下请求URL:
"https://<host>/sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductDescription?$format=json&$filter=(ProductDescription eq '%C3%A4_description')"
这将返回预期的结果。
我没有检查,但这也可能影响到其他VDM包。
SDK本身还是SDK用户应该执行URL编码?我想避免双重编码。
提前谢谢你,
乌杰
https://stackoverflow.com/questions/63357636
复制相似问题