# Basic Auth headers are passed to the UI in the API response

exec bash -x ./test.sh &
karma.bin-should-work --pid-file=karma.pid --alertmanager.uri=http://foo:bar@127.0.0.1 --listen.address=127.0.0.1 --listen.port=8076
wait
stdout '"headers":{"Authorization":"Basic Zm9vOmJhcg=="}'
stdout '"publicURI":"http://foo:bar@127.0.0.1"'

-- test.sh --
while [ ! -f karma.pid ]; do sleep 1 ; done
sleep 1
curl -XPOST -d @request.json -s http://127.0.0.1:8076/alerts.json
cat karma.pid | xargs kill

-- request.json --
{
    "filters": [],
    "gridLabel": "@auto",
    "gridSortReverse": false,
    "gridLimits": {},
    "sortOrder": "",
    "sortLabel": "",
    "sortReverse": false
}
