Closed HAEKADI closed 3 years ago
@MattiSG I have an issue with the last commit. I could use some help :)
When I ran the following test_api
script:
#! /usr/bin/env bash
apt-get update
apt-get install -y jq
make serve-local &
PORT=5000
ENDPOINT=spec
set -e
response=$(curl --retry-connrefused --retry 10 --retry-delay 5 --fail http://127.0.0.1:$PORT/$ENDPOINT | jq -e)
I got an error:
curl: (23) Failed writing body (0 != 15248)
I tried :
response=$(curl --retry-connrefused --retry 10 --retry-delay 5 --fail http://127.0.0.1:$PORT/$ENDPOINT | tac | tac | jq -e)
And I got the same error.
The following command runs with no issues:
curl --retry-connrefused --retry 10 --retry-delay 5 --fail http://127.0.0.1:$PORT/$ENDPOINT | jq -e
Do you have any idea why that is?
No, I don't know why that happens. This makes me suspect jq
is not happy being piped streaming data and expects all contents at once. Let's just use an intermediary variable as suggested earlier 🙂
jq
remains problematic even after adding an intermediary variable; rendering the following error, which I could not fix:
jq: error: syntax error, unexpected $end, expecting QQSTRING_TEXT or QQSTRING_INTERP_START or QQSTRING_END (Unix shell quoting issues?) at <top-level>
So I switched to python -m json.tool
which works, and as a bonus there is no need to add a jq
dependency.
@MattiSG Il faudra rajouter test_api
comme required dans les status checks avant le merge, non ?
Good point! Done now :)
Closes #112.