get-with-auth-code.sh

#!/bin/sh
# Check if endpoint, challenge-id, and response-code parameters are provided
if [ -z "$1" ] || [ -z "$3" ]; then
    echo "Usage: $0 endpoint challenge-id response-code"
    exit 1
fi

# Assign the parameters to variables
endpoint="$1"
challenge_id="$2"
response_code="$3"

# Construct the HTTP headers
challenge_header="ST-Challenge-ID: $challenge_id"
response_header="ST-Challenge-Response: $response_code"

SERVER_URL="${SWGY_SERVER:-http://127.0.0.1}"
# Send the GET request using curl
url="${SERVER_URL}${endpoint}"
curl -k -vvv -X GET -H "$challenge_header" -H "$response_header" "$url"