diff --git a/0x10-python-network_0/3-methods.sh b/0x10-python-network_0/3-methods.sh index 531b07e..26ecd38 100755 --- a/0x10-python-network_0/3-methods.sh +++ b/0x10-python-network_0/3-methods.sh @@ -1,3 +1,10 @@ #!/bin/bash -# Display all HTTP methods the server of a given URL will accept. -curl -sI "$1" | grep "Allow" | cut -d " " -f 2- + +# Check if a URL was provided as an argument +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +# Send an OPTIONS request using curl and extract the Allow header +curl -sI -X OPTIONS "$1" | grep "Allow:" | cut -d ' ' -f2-