Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
650 B
2
Indexable
Never
#!/bin/bash

url="https://example.com"

# Test GET request
get_response=$(curl -s -o /dev/null -w "%{http_code}" "$url")
echo "GET Response: $get_response"

# Test POST request
post_data="param1=value1&param2=value2"
post_response=$(curl -s -o /dev/null -w "%{http_code}" -d "$post_data" -X POST "$url")
echo "POST Response: $post_response"

# Test PUT request
put_data="param1=updated_value"
put_response=$(curl -s -o /dev/null -w "%{http_code}" -d "$put_data" -X PUT "$url")
echo "PUT Response: $put_response"

# Test DELETE request
delete_response=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE "$url")
echo "DELETE Response: $delete_response"
Leave a Comment