fix: use grep on file directly instead of echo piping for body test
Docker Build and Push / lint (pull_request) Successful in 5s
Docker Build and Push / build (pull_request) Successful in 55s
Docker Build and Push / test (pull_request) Successful in 24s
Docker Build and Push / push (pull_request) Has been skipped

This commit is contained in:
2026-06-08 21:10:45 +00:00
parent 2c28c53bcc
commit dc774d6cb7
+9 -2
View File
@@ -66,12 +66,19 @@ cleanup() {
curl -sf -o "$TMPDIR/body" -D "$TMPDIR/headers" "$BASE_URL/" curl -sf -o "$TMPDIR/body" -D "$TMPDIR/headers" "$BASE_URL/"
STATUS=$(head -1 "$TMPDIR/headers" | grep -oP '\d{3}') STATUS=$(head -1 "$TMPDIR/headers" | grep -oP '\d{3}')
CONTENT_TYPE=$(grep -i 'content-type' "$TMPDIR/headers" | tr -d '\r' | cut -d: -f2- | xargs) CONTENT_TYPE=$(grep -i 'content-type' "$TMPDIR/headers" | tr -d '\r' | cut -d: -f2- | xargs)
BODY=$(cat "$TMPDIR/body")
trap cleanup EXIT trap cleanup EXIT
assert "HTTP status is 200" "200" "$STATUS" assert "HTTP status is 200" "200" "$STATUS"
assert_match "Content-Type is text/html" "text/html" "$CONTENT_TYPE" assert_match "Content-Type is text/html" "text/html" "$CONTENT_TYPE"
assert_match "Body contains RSS-Bridge" "[Rr][Ss][Ss].*[Bb]ridge" "$BODY"
TOTAL=$((TOTAL + 1))
if grep -qEi "[Rr][Ss][Ss].*[Bb]ridge" "$TMPDIR/body"; then
echo " PASS: Body contains RSS-Bridge"
PASSED=$((PASSED + 1))
else
echo " FAIL: Body contains RSS-Bridge (pattern not found)"
FAILED=$((FAILED + 1))
fi
echo "" echo ""
echo "Results: $PASSED/$TOTAL passed, $FAILED failed" echo "Results: $PASSED/$TOTAL passed, $FAILED failed"