42 lines
843 B
Bash
Executable File
42 lines
843 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
API_KEY=test
|
|
URL=http://localhost:18080
|
|
|
|
if [ "$1" = g ]; then
|
|
curl -is "$URL/$2" |
|
|
sed -En 's/^[lL]ocation: (.*)/\1/p'
|
|
|
|
elif [ "$1" = s ]; then
|
|
curl \
|
|
-w "${URL}%header{location}" \
|
|
-XPOST \
|
|
-d "$2" \
|
|
-H "X-Api-Key: $API_KEY" \
|
|
"$URL/s/$3"
|
|
|
|
elif [ "$1" = sl ]; then
|
|
curl \
|
|
-w "${URL}%header{location}" \
|
|
-XPOST \
|
|
-d "$2" \
|
|
-H "X-Api-Key: $API_KEY" \
|
|
"$URL/sl/$3"
|
|
|
|
elif [ "$1" = p ]; then
|
|
curl \
|
|
-w "${URL}%header{location}" \
|
|
-XPOST \
|
|
-H "X-Api-Key: $API_KEY" \
|
|
--data-binary @"$2" \
|
|
"$URL/p/$3"
|
|
|
|
elif [ "$1" = pl ]; then
|
|
curl \
|
|
-w "${URL}%header{location}" \
|
|
-XPOST \
|
|
-H "X-Api-Key: $API_KEY" \
|
|
--data-binary @"$2" \
|
|
"$URL/pl/$3"
|
|
fi
|