Skip to content
Snippets Groups Projects

Hotfix/upload

5 files
+ 9
6
Compare changes
  • Side-by-side
  • Inline

Files

#!/bin/bash
GATEWAY="http://localhost"
USERNAME=$(openssl rand -hex 16)
PASSWORD=$(openssl rand -hex 16)
curl -fsSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"${USERNAME}\",\"password\":\"${PASSWORD}\",\"email\":\"${USERNAME}@bar.com\"}" http://localhost/api/user
TOKEN=$(curl -fsSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"${USERNAME}\",\"password\":\"${PASSWORD}\"}" http://localhost/api/user/token | jq -r '.access_token')
RAW_BODY=$(curl -fsSL -i -X POST -H "Authorization: Bearer ${TOKEN}" -H "Tus-Resumable: 1.0.0" -H "Upload-Length: 100" -H "Content-Length: 5" -H "Content-Type: application/offset+octet-stream" -d "Hello this is a test aaa" http://localhost/api/upload/files)
curl -fsSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"${USERNAME}\",\"password\":\"${PASSWORD}\",\"email\":\"${USERNAME}@bar.com\"}" "${GATEWAY}/api/user"
TOKEN=$(curl -fsSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"${USERNAME}\",\"password\":\"${PASSWORD}\"}" "${GATEWAY}/api/user/token" | jq -r '.access_token')
RAW_BODY=$(curl -fsSL -i -X POST -H "Authorization: Bearer ${TOKEN}" -H "Tus-Resumable: 1.0.0" -H "Upload-Length: 100" -H "Content-Length: 5" -H "Content-Type: application/offset+octet-stream" -d "Hello this is a test aaa" "${GATEWAY}/api/upload/files")
if [ ! "$(echo \"$RAW_BODY\" | grep '201 Created')" ]; then
echo "[ERROR] Test Failed"
exit 100
Loading