Skip to content
Snippets Groups Projects
Commit 707bc5e6 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'add-systemdunit' into 'master'

check_http update jq handling

See merge request !165
parents 4b39f29c 2cfde124
No related branches found
No related tags found
1 merge request!165check_http update jq handling
......@@ -115,6 +115,7 @@ sLabel=$( ph.getValueWithParam "" l "$@")
curlParams+=" -si -X $sMethod --connect-timeout 10"
sProblems=
sInfos=
sOK=
if [ -z "$sUrl" ]; then
......@@ -136,6 +137,13 @@ else
if [ -n "$sJq" ]; then
_body=$( jq "$sJq" <<< "$_body" 2>/dev/null )
if [ -z "$_body" ]; then
ph.setStatus critical
sProblems+="- jq filter [$sJq] was applied and resulted in an empty result.\n"
else
sInfos+="- jq filter [$sJq] was applied.\n"
sInfos+="${_body}"
fi
fi
# --- test status
......@@ -205,6 +213,7 @@ fi
# --- output
test -n "$sProblems" && sProblems="Problems:\n$sProblems\n"
test -n "$sOK" && sOK="Found:\n$sOK"
test -n "$sInfos" && sInfos="\nHints:\n$sInfos"
test -n "$sLabel" && (
ph.status "$sLabel"
......@@ -213,7 +222,7 @@ test -n "$sLabel" && (
test -n "$sLabel" || ph.status "$sMethod $sUrl ($iHttpStatus)"
echo
echo -e "${sProblems}${sOK}"
echo -e "${sProblems}${sOK}${sInfos}"
test -n "${sProblems}" && (echo "RESPONSE HEADER:"; echo; echo "$_header")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment