aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/check_web.sh
blob: b011f5d491ac1bdb4f01c5c19c4db0d03062e483 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail
shopt -s inherit_errexit lastpipe

readonly base_url='http://127.0.0.1:8090/'

run_curl() {
    curl -sS -D - --connect-timeout 3 "$@"
}

call_web_method() {
    local method
    for method; do
        echo ------------------------------------------------------------------
        echo "Checking /api/$method"
        echo ------------------------------------------------------------------
        run_curl -- "$base_url/api/$method"
    done
}

check_web() {
    call_web_method ListPeers
    call_web_method GetDeviceInfo
}

main() {
    check_web
}

main