From 7520c97ae5c6c73a49fd4c5eb36eb82c9ba0a6a9 Mon Sep 17 00:00:00 2001 From: kexkey Date: Mon, 12 Aug 2019 16:31:38 -0400 Subject: [PATCH] Fix issue 118, curl http_code sometimes is 000 but it's an invalid JSON number --- notifier_docker/script/web.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notifier_docker/script/web.sh b/notifier_docker/script/web.sh index 4e07f35..10b0ccd 100644 --- a/notifier_docker/script/web.sh +++ b/notifier_docker/script/web.sh @@ -63,6 +63,8 @@ curl_it() { else response= fi + # When curl is unable to connect, http_code is "000" which is not a valid JSON number + [ "${rc}" -eq "0" ] && rc=0 response="{\"curl_code\":${returncode},\"http_code\":${rc},\"body\":\"${response}\"}" echo "${response}"