File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 2121SHOW_HEADER=0
2222HEADER_ONLY=0
2323SILENT=0
24+ API_ERROR=0
2425
2526echo_v () {
2627 if [ $VERBOSE -eq 1 ]; then
@@ -71,15 +72,23 @@ run() {
7172
7273api_factory () {
7374 for TEST_CASE in $@ ; do
75+ API_ERROR=0
7476 echo " ${BOLD} Running Case:${RESET} $TEST_CASE "
7577 echo_v " ${BOLD} Description: ${RESET} $( jq -r " .testCases.$TEST_CASE .description" $FILE ) "
7678 echo_v " ${BOLD} Action: ${RESET} $( jq -r " .testCases.$TEST_CASE .method //\" GET\" | ascii_upcase" $FILE ) $( jq -r " .testCases.$TEST_CASE .path" $FILE ) "
7779 call_api $TEST_CASE
7880 display_results
81+ echo " "
82+ echo " "
7983 done
8084}
8185
8286display_results () {
87+
88+ if [[ $API_ERROR == 1 ]]; then
89+ return
90+ fi
91+
8392 local res=$( jq -r ' .http_status + " " + .http_message ' <<< " $RESPONSE_HEADER" )
8493 local status=$( jq -r ' .http_status' <<< " $RESPONSE_HEADER" )
8594 echo " Response:"
@@ -100,8 +109,6 @@ display_results() {
100109 fi
101110 echo " META:"
102111 echo " $META " | jq -C
103- echo " "
104- echo " "
105112}
106113
107114color_response () {
@@ -131,6 +138,7 @@ call_api() {
131138
132139 if [[ $raw_output == * " AUTO_API_ERROR" * ]]; then
133140 echo " Problem connecting to $URL "
141+ API_ERROR=1
134142 return 1
135143 fi
136144 local header=" $( awk -v bl=1 ' bl{bl=0; h=($0 ~ /HTTP\//)} /^\r?$/{bl=1} {if(h)print $0 }' <<< " $raw_output" ) "
You can’t perform that action at this time.
0 commit comments