rpc.sh: improve flags for curl wrapper
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
f8f2e33772
commit
210156c5de
|
@ -6,6 +6,7 @@ URL="http://{{ geth_rpc_addr }}:{{ geth_rpc_port }}/"
|
||||||
|
|
||||||
METHOD="$1"
|
METHOD="$1"
|
||||||
shift
|
shift
|
||||||
|
PARAMS=("$@")
|
||||||
|
|
||||||
if [[ -z "${METHOD}" ]]; then
|
if [[ -z "${METHOD}" ]]; then
|
||||||
echo "No method specified!" >&2
|
echo "No method specified!" >&2
|
||||||
|
@ -25,8 +26,11 @@ PAYLOAD="{
|
||||||
\"params\": [${PARAMS}]
|
\"params\": [${PARAMS}]
|
||||||
}"
|
}"
|
||||||
|
|
||||||
curl -s -X POST \
|
# The jq script checks if error exists and adjusts exit code.
|
||||||
-H "Content-type:application/json" \
|
curl --request POST \
|
||||||
|
--silent \
|
||||||
|
--fail-with-body \
|
||||||
|
--header 'Content-type:application/json' \
|
||||||
--data "${PAYLOAD}" \
|
--data "${PAYLOAD}" \
|
||||||
"${URL}" | \
|
"${URL}" | \
|
||||||
jq -e '., if .error != null then null|halt_error(2) else halt end'
|
jq -e '., if .error != null then null|halt_error(2) else halt end'
|
||||||
|
|
Loading…
Reference in New Issue