fix body encoding

هذا الالتزام موجود في:
2025-10-07 07:29:01 +03:00
ملتزم من قبل Kamar El-Dawla Shalaby
الأصل f57767aa8c
التزام 4e3c036c0a

عرض الملف

@@ -51,6 +51,13 @@ jq -c '.[]' "$TEST_FILE" | while read -r test; do
retries=$(jq -r '.retries // 0' <<<"$test")
follow_location=$(jq -r '.follow_location // false' <<<"$test")
encoded_body=""
if [[ -n "$body" ]]; then
if ! encoded_body=$(jq -r '@json' <<<"$body" 2>/dev/null); then
echo "[$idx/$TOTAL] $name -> ERROR: Invalid JSON body" >&2
continue
fi
fi
CURL_HDR_ARGS=()
if jq -e 'type=="object"' <<<"$headers_json" >/dev/null 2>&1; then
@@ -143,8 +150,6 @@ jq -c '.[]' "$TEST_FILE" | while read -r test; do
cat "$temp_resp" >&2
fi
fi
if (( attempt <= retries )); then sleep 1; continue; else break; fi
done
result=$(jq -n \
@@ -162,6 +167,10 @@ jq -c '.[]' "$TEST_FILE" | while read -r test; do
echo "[$idx/$TOTAL] $name -> OK (status $http_code, ${latency_ms}ms)"
else
echo "[$idx/$TOTAL] $name -> FAIL (status ${http_code:-n/a}, reason: $last_err)" >&2
if [[ -s "$temp_resp" ]]; then
echo "Response body:" >&2
cat "$temp_resp" >&2
fi
fi
rm -f "$temp_resp"