0
0
mirror of https://github.com/letic/Shell-Scripts.git synced 2024-09-27 21:46:03 +00:00
AWS_Shell-Scripts/verify-curl-responses-with-custom-headers.sh

20 lines
515 B
Bash
Raw Normal View History

#!/bin/bash
function verify {
local url=$1
local headers=${2:-''}
local default_header='-H "X-Enable-Something: on"'
printf "\n\nURL: $url\nHEADERS: $default_header $headers\n\n"
local response=$(eval "curl -sI $default_header $headers $url")
echo "response: $response"
printf "\n\n#############"
}
env='stage'
host="https://foo:bar@$env.example.com"
verify "$host/testing"
verify "$host/foobar" '-H "User-Agent: iphone"'
verify "$host/beepboop" '-H "X-Custom-Foo: true" -H "X-Custom-Bar: false"'