From b89c1daec802bf25dca950dae9902d1abc97a2d9 Mon Sep 17 00:00:00 2001 From: Seth Gransky Date: Sun, 10 Feb 2019 19:28:21 -0600 Subject: [PATCH] Check return codes not strings. --- examples/docker/run_python.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/docker/run_python.sh b/examples/docker/run_python.sh index 84ec092..786e0e2 100644 --- a/examples/docker/run_python.sh +++ b/examples/docker/run_python.sh @@ -42,11 +42,13 @@ function cleanURL() { } function validateURL() { - match=$(curl "${ping_url}/ping" -H "X-RosetteAPI-Key: ${API_KEY}" -H "user_key: ${API_KEY}" | grep -o "Rosette API") - if [ "${match}" = "" ]; then - echo -e "\n${ping_url} server not responding\n" + output_file=validate_url_out.log + http_status_code=$(curl -s -o "${output_file}" -w "%{http_code}" -H "X-RosetteAPI-Key: ${API_KEY}" "${ping_url}/ping") + if [ "${http_status_code}" != "200" ]; then + echo -e "\n${ping_url} server not responding. Output is:\n" + cat "${output_file}" exit 1 - fi + fi } function runExample() {