mirror of
https://codeberg.org/vlw/curl.git
synced 2026-04-13 02:39:38 +02:00
fix: append search parameters to URL only if set (#14)
Append search parameters to URL only if search parameters are provided. This means that "?" will not be appended to the URL if no parameters are provided. Reviewed-on: https://codeberg.org/vlw/curl/pulls/14
This commit is contained in:
parent
832bea4252
commit
29090ad555
1 changed files with 4 additions and 1 deletions
5
curl.sh
5
curl.sh
|
|
@ -23,7 +23,10 @@ method="${2:-GET}"
|
||||||
if [ -f $REQ_PARAMS_FILE ]; then
|
if [ -f $REQ_PARAMS_FILE ]; then
|
||||||
# Parse each newline as a separate parameter joined by a "&"
|
# Parse each newline as a separate parameter joined by a "&"
|
||||||
params=$(tr '\n' '&' < "$REQ_PARAMS_FILE" | sed 's/&$//')
|
params=$(tr '\n' '&' < "$REQ_PARAMS_FILE" | sed 's/&$//')
|
||||||
url="${url}?${params}"
|
|
||||||
|
if [ -n "$params" ]; then
|
||||||
|
url="${url}?${params}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prepare curl
|
# Prepare curl
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue