mirror of
https://codeberg.org/vlw/curl.git
synced 2026-04-13 02:39:38 +02:00
feat: default method to GET if not provided
This commit is contained in:
parent
a42be0792c
commit
967d57cb96
1 changed files with 3 additions and 3 deletions
6
curl.sh
6
curl.sh
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Check if the correct number of arguments is provided
|
# Check if the correct number of arguments is provided
|
||||||
if [ "$#" -ne 2 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo "Usage: $0 <url> <request_method>"
|
echo "Usage: $0 <url> [request_method]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ RESP_BODY_RAW_FILE="curl/resp_body.txt"
|
||||||
RESP_BODY_JSON_FILE="curl/resp_body.json"
|
RESP_BODY_JSON_FILE="curl/resp_body.json"
|
||||||
|
|
||||||
url="$1"
|
url="$1"
|
||||||
method="$2"
|
method="${2:-GET}"
|
||||||
|
|
||||||
# Append url search parameters
|
# Append url search parameters
|
||||||
if [ -f $REQ_PARAMS_FILE ]; then
|
if [ -f $REQ_PARAMS_FILE ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue