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
Branches
No related tags found
1 merge request!166update jq filtering
......@@ -135,14 +135,20 @@ else
_header=$(echo "$out" | sed -n "1,${iHeaderEnd}p")
_body=$( echo "$out" | sed -n "${iHeaderEnd},\$p")
# --- jq filter
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"
sProblems+="- jq filter [$sJq] was applied and resulted in an empty result. The reponse from url was no JSON.\n"
else
sInfos+="- jq filter [$sJq] was applied.\n"
sInfos+="${_body}"
if [ "$_body" = "null" ]; then
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment