Return the data directly in GET /arbitrary/{service}/{name}, instead of a path to the data

This commit is contained in:
CalDescent
2021-10-29 18:52:05 +01:00
parent 24ca126f5a
commit 3934120541
2 changed files with 28 additions and 17 deletions

View File

@@ -74,19 +74,11 @@ elif [[ "${method}" == "GET" ]]; then
rebuild="false"
fi
response=$(curl --silent --insecure -X GET "http://${host}:${port}/arbitrary/${service}/${name}?rebuild=${rebuild}" -H "Content-Type: application/json" -d "{\"privateKey\":\"${private_key}\",\"transactionBytes\":\"${tx_data}\"}")
response=$(curl --silent --insecure -X GET "http://${host}:${port}/arbitrary/${service}/${name}?rebuild=${rebuild}&filepath=${filepath}")
if [[ "${response}" == *"error"* || "${response}" == *"ERROR"* ]]; then
echo "${response}"; exit
fi
# Parse the successful response
output_path="${response}/${filepath}"
if [ ! -f "${output_path}" ] && [ ! -d "${output_path}" ]; then
echo "Error: file not found at path: ${output_path}"
echo "Please ensure you have supplied a valid filepath."
exit
fi
cat "${output_path}"
echo "${response}"
fi