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

update jq filtering

parent 2cfde124
No related branches found
No related tags found
1 merge request!166update jq filtering
...@@ -135,14 +135,20 @@ else ...@@ -135,14 +135,20 @@ else
_header=$(echo "$out" | sed -n "1,${iHeaderEnd}p") _header=$(echo "$out" | sed -n "1,${iHeaderEnd}p")
_body=$( echo "$out" | sed -n "${iHeaderEnd},\$p") _body=$( echo "$out" | sed -n "${iHeaderEnd},\$p")
# --- jq filter
if [ -n "$sJq" ]; then if [ -n "$sJq" ]; then
_body=$( jq "$sJq" <<< "$_body" 2>/dev/null ) _body=$( jq "$sJq" <<< "$_body" 2>/dev/null )
if [ -z "$_body" ]; then if [ -z "$_body" ]; then
ph.setStatus critical ph.setStatus critical
sProblems+="- jq filter [$sJq] was applied and resulted in an empty result.\n" sProblems+="- jq filter [$sJq] was applied and resulted in an empty result. The reponse from url was no JSON.\n"
else else
sInfos+="- jq filter [$sJq] was applied.\n" if [ "$_body" = "null" ]; then
sInfos+="${_body}" ph.setStatus critical
sProblems+="- jq filter [$sJq] does not match on responded JSON.\n"
else
sOK+="- jq filter [$sJq] matches.\n"
sInfos+="Content aufter jq filter: ${_body}"
fi
fi fi
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment