Create verify-curl-responses-with-custom-headers.sh

This commit is contained in:
Mark McDonnell 2016-08-12 16:47:29 +01:00 committed by GitHub
parent e0109918ac
commit e6588efa06
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#!/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"'