fix: use grep on file directly instead of echo piping for body test
This commit is contained in:
+9
-2
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user