Skip to content

Commit 8cc19aa

Browse files
committed
support curl extra headers
1 parent 20b8db5 commit 8cc19aa

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/e2e-shell-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181
SFCC_SHORTCODE: ${{ vars.SFCC_SHORTCODE }}
8282
TEST_REALM: ${{ vars.TEST_REALM }}
8383
SFCC_EXTRA_HEADERS: ${{ secrets.SFCC_EXTRA_HEADERS }}
84+
CURL_EXTRA_HEADERS: ${{ secrets.CURL_EXTRA_HEADERS }}
8485
run: |
8586
echo "Running E2E shell tests with realm: ${TEST_REALM}"
8687
cd packages/b2c-cli

packages/b2c-cli/test/functional/e2e_cli_test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,17 @@ SLAS_BASE="https://${SFCC_SHORTCODE}.api.commercecloud.salesforce.com"
198198
echo " ORG ID: $ORG_ID"
199199
echo " SLAS Base: $SLAS_BASE"
200200

201+
# Build curl extra headers args if set (newline-separated, e.g. "X-Header: value")
202+
CURL_HEADER_ARGS=()
203+
if [ -n "$CURL_EXTRA_HEADERS" ]; then
204+
while IFS= read -r header; do
205+
[ -n "$header" ] && CURL_HEADER_ARGS+=(-H "$header")
206+
done <<< "$CURL_EXTRA_HEADERS"
207+
fi
208+
201209
# Get shopper token via client credentials (guest login)
202210
TOKEN_RESPONSE=$(curl -s "${SLAS_BASE}/shopper/auth/v1/organizations/${ORG_ID}/oauth2/token" \
211+
"${CURL_HEADER_ARGS[@]}" \
203212
-u "${SLAS_CLIENT_ID}:${SLAS_SECRET}" \
204213
-d "grant_type=client_credentials&channel_id=${SITE_ID}")
205214

@@ -220,6 +229,7 @@ echo ""
220229
echo "Step 8: Testing shopper product search..."
221230

222231
SEARCH_RESPONSE=$(curl -s "${SLAS_BASE}/search/shopper-search/v1/organizations/${ORG_ID}/product-search?siteId=${SITE_ID}&limit=5&q=sample" \
232+
"${CURL_HEADER_ARGS[@]}" \
223233
-H "Authorization: Bearer ${SHOPPER_TOKEN}")
224234

225235
# Check if we got a valid response (should have a 'hits' array or 'total' field)

0 commit comments

Comments
 (0)