File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 51
51
local description="$4"
52
52
53
53
echo "Making $description API call..."
54
+ echo "URL: $url"
55
+ echo "Method: $method"
56
+ echo "Data: $data"
57
+
54
58
response=$(curl -s -w "\n%{http_code}" \
55
59
--request "$method" "$url" \
56
60
--header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
@@ -61,12 +65,25 @@ jobs:
61
65
body=$(echo "$response" | sed '$d')
62
66
63
67
echo "Status code: $status_code"
68
+ echo "Response body: $body"
69
+
64
70
if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
65
71
echo "Failed $description. Status: $status_code"
66
72
echo "Response: $body"
67
73
return 1
68
74
fi
69
75
76
+ if [[ -z "$body" ]]; then
77
+ echo "Empty response body"
78
+ return 1
79
+ fi
80
+
81
+ # Validate JSON response
82
+ if ! echo "$body" | python3 -c "import sys, json; json.load(sys.stdin)" > /dev/null 2>&1; then
83
+ echo "Invalid JSON response"
84
+ return 1
85
+ fi
86
+
70
87
echo "$body"
71
88
return 0
72
89
}
You can’t perform that action at this time.
0 commit comments