From 328cebc703b3f3d019a5eb3c1b51ca2b31c96868 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Mon, 6 Apr 2026 10:25:07 +0200 Subject: [PATCH] feat: default method to GET if not provided (#9) Set the default request method to `GET` if no method is provided Reviewed-on: https://codeberg.org/vlw/curl/pulls/9 --- curl.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/curl.sh b/curl.sh index 0f24b3c..96b902f 100755 --- a/curl.sh +++ b/curl.sh @@ -1,8 +1,8 @@ #!/bin/bash # Check if the correct number of arguments is provided -if [ "$#" -ne 2 ]; then - echo "Usage: $0 " +if [ "$#" -ne 1 ]; then + echo "Usage: $0 [request_method]" exit 1 fi @@ -17,7 +17,7 @@ RESP_BODY_RAW_FILE="curl/resp_body.txt" RESP_BODY_JSON_FILE="curl/resp_body.json" url="$1" -method="$2" +method="${2:-GET}" # Append url search parameters if [ -f $REQ_PARAMS_FILE ]; then