27 lines
523 B
Bash
Executable File
27 lines
523 B
Bash
Executable File
#!/bin/bash
|
|
|
|
function list {
|
|
echo "Available test payloads:"
|
|
for file in ./tests/*; do
|
|
echo $(basename ${file} .json)
|
|
done
|
|
}
|
|
|
|
[[ $# != 1 ]] && list && exit 0
|
|
|
|
file="./tests/${1}"
|
|
if [ ! -f ${file} ]; then
|
|
if [ -f ${file}.json ]; then
|
|
file="${file}.json"
|
|
else
|
|
echo "File not found: ${file}"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
curl -f -H "REMOTE_USER: apitest" -H "Content-Type: application/json" -d @${file} http://localhost:3030/api
|
|
|
|
[[ $? != 0 ]] && echo "HTTP ERROR" && exit 1
|
|
|
|
echo ""
|