Compare commits

..

2 commits

Author SHA1 Message Date
64db42527b refactor: preserve terminal screen and scrollbuffer (#13)
Maintain the terminal output. If clearing the screen and scrollbuffer is desired, it should be wrapped in an upstream script.

Reviewed-on: https://codeberg.org/vlw/curl/pulls/13
2026-04-12 10:42:17 +02:00
29090ad555 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
2026-04-12 10:42:00 +02:00

View file

@ -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
@ -63,9 +66,7 @@ fi
# Save the response headers and body # Save the response headers and body
curl_cmd="$curl_cmd -o $RESP_BODY_RAW_FILE -D $RESP_HEADERS_FILE" curl_cmd="$curl_cmd -o $RESP_BODY_RAW_FILE -D $RESP_HEADERS_FILE"
# Execute curl # Dispatch request
eval "clear"
echo -e "\e[0;92mRequest >\e[0m ${method} ${url}" echo -e "\e[0;92mRequest >\e[0m ${method} ${url}"
eval $curl_cmd eval $curl_cmd