fix(protocol-matrix): restore live probe auth header
Some checks are pending
CI / Quality Gates (push) Waiting to run
CI / Build & Test (push) Blocked by required conditions
CI / Lint (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / Docker Build (push) Waiting to run
CI / Release (push) Blocked by required conditions

This commit is contained in:
phamnazage-jpg
2026-06-11 21:52:24 +08:00
parent 47ced19c7b
commit bdfbaff2a7
6 changed files with 80 additions and 24 deletions

View File

@@ -181,7 +181,7 @@ def run_capture(url: str, api_key: str, method: str, request_headers_path: pathl
"--retry-delay",
str(RETRY_DELAY),
"-H",
"Authorization: Bearer ***",
f"Authorization: Bearer {api_key}",
"-H",
f"X-Hermes-Debug-Request-Headers: {request_headers_path}",
]

View File

@@ -67,6 +67,7 @@ body_file=""
url=""
request_headers_file=""
request_body=""
auth_header=""
prev=""
log_file="${FAKE_CURL_LOG:-}"
for arg in "$@"; do
@@ -87,7 +88,9 @@ for arg in "$@"; do
continue
;;
-H)
if [[ "$arg" == X-Hermes-Debug-Request-Headers:* ]]; then
if [[ "$arg" == Authorization:* ]]; then
auth_header="$arg"
elif [[ "$arg" == X-Hermes-Debug-Request-Headers:* ]]; then
request_headers_file="${arg#X-Hermes-Debug-Request-Headers: }"
fi
prev=""
@@ -115,6 +118,20 @@ if [[ -n "$request_headers_file" ]]; then
printf 'Authorization: Bearer ***\n' > "$request_headers_file"
printf 'Content-Type: application/json\n' >> "$request_headers_file"
fi
case "$url" in
https://kimi.example.com/*)
[[ "$auth_header" == 'Authorization: Bearer kimi-key' ]] || {
echo "unexpected auth header for kimi: $auth_header" >&2
exit 1
}
;;
https://timeout.example.com/*)
[[ "$auth_header" == 'Authorization: Bearer timeout-key' ]] || {
echo "unexpected auth header for timeout provider: $auth_header" >&2
exit 1
}
;;
esac
case "$url" in
https://kimi.example.com/v1/models)
printf 'HTTP/1.1 200 OK\nContent-Type: application/json\n' > "$headers_file"