check_curl: add method back in

This commit is contained in:
Cyberes 2023-06-22 12:53:38 -06:00
parent df49e77703
commit 6ac2c4b9c1
1 changed files with 7 additions and 2 deletions

View File

@ -12,6 +12,7 @@ usage() {
-H Specify headers. Formatted like \"Header1: value,Header2: value\"
-p Print the curl command and exit
-R Set curl --resolve option.
-M Set the HTTP mode (default: GET)
-s Ignore the response status code."
exit 3
}
@ -26,9 +27,10 @@ PRINT_CURL=""
RESOLVE=""
IGNORE_STATUS=""
TIMEOUT=""
HTTP_METHOD="-X GET"
# Parse arguments
while getopts "u:w:c:C:LH:IpR:st:h" opt; do
while getopts "u:w:c:C:LH:M:IpR:st:h" opt; do
case $opt in
u)
URL="$OPTARG"
@ -63,6 +65,9 @@ while getopts "u:w:c:C:LH:IpR:st:h" opt; do
t)
TIMEOUT="--max-time $OPTARG"
;;
M)
HTTP_METHOD="-X $OPTARG"
;;
h)
usage
;;
@ -81,7 +86,7 @@ if [ -z "$URL" ]; then
fi
# Prepare curl command
CURL_CMD="curl -w %{http_code};%{time_total} -o /dev/null -s $FOLLOW_REDIRECTS $INSECURE $HEADERS $RESOLVE $TIMEOUT $URL"
CURL_CMD="curl -w %{http_code};%{time_total} -o /dev/null -s $HTTP_METHOD $FOLLOW_REDIRECTS $INSECURE $HEADERS $RESOLVE $TIMEOUT $URL"
# Print curl command if requested
if [ "$PRINT_CURL" = "yes" ]; then