Query params that begin with c_ are considered custom query parameters and are passed onto the underlying SCAPI call. Any other query params that aren't a part of the SCAPI endpoint spec will be filtered out and not passed.
Create a new node project in a separate directory:
mkdir testCustomParams
cd testCustomParams
npm init -y
touch index.js
modify package.json in testCustomParams directory to point commerce-sdk-isomorphic to local directory in dependencies section and add "type": "module":
This PR adds support for custom query parameters as SCAPI now supports SCAPI hooks: https://developer.salesforce.com/docs/commerce/commerce-api/references/about-commerce-api/about.html#08302023
Query params that begin with
c_
are considered custom query parameters and are passed onto the underlying SCAPI call. Any other query params that aren't a part of the SCAPI endpoint spec will be filtered out and not passed.This PR also adds node 18 & 20 to the CI
Testing this PR takes a bit of set up:
git clone git@github.com:SalesforceCommerceCloud/commerce-sdk-isomorphic.git
git checkout ju/support-custom-params
yarn install
modify
templates/operations.ts.hbs
to add aconsole.log()
to check query params:yarn run renderTemplates && yarn run build:lib
Create a new node project in a separate directory:
modify
package.json
intestCustomParams
directory to pointcommerce-sdk-isomorphic
to local directory independencies
section and add"type": "module"
:npm install
index.js
and replace client credsnode index.js > out.txt
Observe
out.txt
and that the custom query params are included in the fetch call and invalid query params are excluded from the call: