expect response
This commit is contained in:
parent
7dd8af3806
commit
5dccd96f34
@ -16,6 +16,14 @@ echo "body: $INPUT_BODY"
|
|||||||
|
|
||||||
url="https://oapi.dingtalk.com/robot/send?access_token=${INPUT_DINGTOKEN}"
|
url="https://oapi.dingtalk.com/robot/send?access_token=${INPUT_DINGTOKEN}"
|
||||||
|
|
||||||
curl -s "$url" \
|
HTTP_RESPONSE=$(curl -s --write-out "HTTPSTATUS:%{http_code}" "$url" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d "${INPUT_BODY}"
|
-d "${INPUT_BODY}")
|
||||||
|
|
||||||
|
# extract the body
|
||||||
|
HTTP_BODY=$(echo "$HTTP_RESPONSE" | sed -e 's/HTTPSTATUS\:.*//g')
|
||||||
|
|
||||||
|
if [ ! "$HTTP_BODY" = '{"errcode":0,"errmsg":"ok"}' ]; then
|
||||||
|
echo "Error Response: ${HTTP_RESPONSE}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user