File: curl-test.sh

package info (click to toggle)
json2file-go 1.15
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: sh: 298; makefile: 10
file content (21 lines) | stat: -rwxr-xr-x 657 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# NOTE: The test assumes that we have a ':' entry on the J2F_DIRLIST variable
DATE="$(date)"
test_sock() {
    sudo curl --header "Content-Type: application/json" \
              --request POST \
              --data "{\"date\":\"$DATE\",\"type\":\"socket\"}" \
              --unix-socket "/run/json2file-go/socket" \
              http://localhost/
}
test_http() {
    sudo curl --header "Content-Type: application/json" \
              --request POST \
              --data "{\"date\":\"$DATE\",\"test\":\"http\"}" \
              http://localhost/json/
}
case "$1" in
http) test_http;;
sock) test_sock;;
*) echo "Usage: $0 {http|sock}";;
esac