[enh] Fix curl helper without POST data

- Allow to use this helper without any POST data
- Keep curl more quiet
This commit is contained in:
Maniack Crudelis 2017-04-26 19:51:51 +02:00 committed by GitHub
parent 12b7c438a9
commit 558323f6f2

View file

@ -46,9 +46,12 @@ ynh_local_curl () {
do
POST_data="${POST_data}${arg}&"
done
# (Remove the last character, which is an unecessary '&')
POST_data=${POST_data::-1}
if [ -n "$POST_data" ]
then
# Add --data arg and remove the last character, which is an unecessary '&'
POST_data="--data \"${POST_data::-1}\""
fi
# Curl the URL
curl -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 --data "$POST_data" "$full_page_url" 2>&1
curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url"
}