Skip to content

Commit

Permalink
Improve failure handing
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Oct 14, 2023
1 parent 3eaa9f5 commit b3ed84a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@ DID_FAIL=0
checkUrl() {
set +e
if [ "${2:-}" = "form" ]; then
curl -# --cookie-jar /tmp/test.cookie-jar -b /tmp/test.cookie-jar --fail \
curl -# --cookie-jar /tmp/test.cookie-jar -b /tmp/test.cookie-jar --show-error --fail-with-body \
-s \
-H 'Content-Type: application/json' \
-L \
-o /dev/stdout \
--data-raw "${3}" \
"$1"
else
curl -# --cookie-jar /tmp/test.cookie-jar -b /tmp/test.cookie-jar --fail \
curl -# --cookie-jar /tmp/test.cookie-jar -b /tmp/test.cookie-jar --show-error --fail-with-body \
-s \
${2:-} \
-H 'Content-Type: application/json' \
-o /dev/stdout \
"$1"
fi
set -e

if [ $? -gt 0 ]; then
echo "FAIL: ${1} ($?)"
DID_FAIL=1
echo "FAIL: ${1}"
return;
fi
echo "PASS: ${1}"
set -e
}

echo "Running tests..."
Expand Down

0 comments on commit b3ed84a

Please sign in to comment.