2022-11-15 22:49:36 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
API_KEY=test
|
|
|
|
URL=http://localhost:18080
|
|
|
|
|
2022-11-21 21:02:33 +01:00
|
|
|
if [ "$1" = g ]; then
|
|
|
|
curl -is "$URL/$2" |
|
|
|
|
sed -En 's/^[lL]ocation: (.*)/\1/p'
|
|
|
|
|
|
|
|
elif [ "$1" = s ]; then
|
2022-11-15 22:49:36 +01:00
|
|
|
curl \
|
2023-05-31 13:03:14 +02:00
|
|
|
-w "${URL}%header{location}" \
|
2022-11-15 22:49:36 +01:00
|
|
|
-XPOST \
|
2022-11-21 12:03:16 +01:00
|
|
|
-d "$2" \
|
2022-11-15 22:49:36 +01:00
|
|
|
-H "X-Api-Key: $API_KEY" \
|
2022-11-21 15:45:31 +01:00
|
|
|
"$URL/s/$3"
|
2022-11-16 13:05:09 +01:00
|
|
|
|
2022-11-21 21:02:33 +01:00
|
|
|
elif [ "$1" = sl ]; then
|
|
|
|
curl \
|
2023-05-31 13:03:14 +02:00
|
|
|
-w "${URL}%header{location}" \
|
2022-11-21 21:02:33 +01:00
|
|
|
-XPOST \
|
|
|
|
-d "$2" \
|
|
|
|
-H "X-Api-Key: $API_KEY" \
|
|
|
|
"$URL/sl/$3"
|
|
|
|
|
|
|
|
elif [ "$1" = p ]; then
|
|
|
|
curl \
|
2023-05-31 13:03:14 +02:00
|
|
|
-w "${URL}%header{location}" \
|
2022-11-21 21:02:33 +01:00
|
|
|
-XPOST \
|
|
|
|
-H "X-Api-Key: $API_KEY" \
|
|
|
|
--data-binary @"$2" \
|
|
|
|
"$URL/p/$3"
|
2022-11-21 16:22:52 +01:00
|
|
|
|
2022-11-21 21:02:33 +01:00
|
|
|
elif [ "$1" = pl ]; then
|
|
|
|
curl \
|
2023-05-31 13:03:14 +02:00
|
|
|
-w "${URL}%header{location}" \
|
2022-11-21 21:02:33 +01:00
|
|
|
-XPOST \
|
|
|
|
-H "X-Api-Key: $API_KEY" \
|
|
|
|
--data-binary @"$2" \
|
|
|
|
"$URL/pl/$3"
|
2022-11-15 22:49:36 +01:00
|
|
|
fi
|