Create verify-curl-responses-with-custom-headers.sh
This commit is contained in:
parent
e0109918ac
commit
e6588efa06
|
@ -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"'
|
Loading…
Reference in New Issue