Using the SAP Cloud SDK JavaScript (@sap-cloud-sdk/core version 1.26.1, @sap/cloud-sdk-vdm-product-service version 1.19.0) ODATA filters are not percent encoded in the URL query part.
Example: (Assuming a product with description "ä_description" exists)
The following example does not retrieve this product 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);
This snippet produces the following request URL:
"https://<host>/sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductDescription?$format=json&$filter=(ProductDescription eq 'ä_description')"
When performing percent-encoding on the search term (const term = encodeURIComponent('ä_description');
) the following request URL is generated:
"https://<host>/sap/opu/odata/sap/API_PRODUCT_SRV/A_ProductDescription?$format=json&$filter=(ProductDescription eq '%C3%A4_description')"
This returns the expected result.
I haven't checked but this may affect other VDM packages as well.
Should the SDK itself or the SDK user perform URL encoding? I want to avoid double encoding.
Thanks in advance,
ujj
The version 1.27.0 has been released last week. The SDK handles the url encoding from this version. Please try it. See release notes here.