diff --git a/external_curl.sh b/external_curl.sh new file mode 100755 index 0000000..75a7265 --- /dev/null +++ b/external_curl.sh @@ -0,0 +1,8 @@ +# Exit if any of the intermediate steps fail +set -e + +export BODY=`curl -s --retry $2 --connect-timeout $3 $1 || echo -n noresponse` +# Safely produce a JSON object containing the result value. +# jq will ensure that the value is properly quoted +# and escaped to produce a valid JSON string. +jq -n --arg BODY "$BODY" '{"body":$BODY}' \ No newline at end of file