Skip to content

Commit b89c1da

Browse files
committed
Check return codes not strings.
1 parent 2ee4456 commit b89c1da

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

examples/docker/run_python.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ function cleanURL() {
4242
}
4343

4444
function validateURL() {
45-
match=$(curl "${ping_url}/ping" -H "X-RosetteAPI-Key: ${API_KEY}" -H "user_key: ${API_KEY}" | grep -o "Rosette API")
46-
if [ "${match}" = "" ]; then
47-
echo -e "\n${ping_url} server not responding\n"
45+
output_file=validate_url_out.log
46+
http_status_code=$(curl -s -o "${output_file}" -w "%{http_code}" -H "X-RosetteAPI-Key: ${API_KEY}" "${ping_url}/ping")
47+
if [ "${http_status_code}" != "200" ]; then
48+
echo -e "\n${ping_url} server not responding. Output is:\n"
49+
cat "${output_file}"
4850
exit 1
49-
fi
51+
fi
5052
}
5153

5254
function runExample() {

0 commit comments

Comments
 (0)