Skip to content

Commit

Permalink
refactor: Improve response handling and readability
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Jun 20, 2024
1 parent c71fe24 commit 8bf663f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/actions/checkpoint-sync/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ runs:
check_endpoint() {
local path=$1
local accept_header=$2
local response=$(curl -s -H "accept: ${accept_header}" "localhost:5555${path}")
local http_code=$(curl -s -o /dev/null -w "%{http_code}" -H "accept: ${accept_header}" "localhost:5555${path}")
local response=$(curl -s -w "\n%{http_code}" -H "accept: ${accept_header}" "localhost:5555${path}")
local http_code=$(echo "$response" | tail -n1)
local json_response=$(echo "$response" | sed '$d')
if [[ $http_code -ge 200 && $http_code -lt 300 ]]; then
echo $response
echo $json_response
return 0
else
echo "Endpoint ${path} with accept header ${accept_header} is not available."
Expand Down

0 comments on commit 8bf663f

Please sign in to comment.