utility-option
curl --data-urlencode
Encode a query parameter value for GET, rather than interpolating raw text in a URL. This does not validate authorization or destination. Local mock server required.
Formal Syntax & Structure
bash syntaxbash
curl --get --data-urlencode NAME=VALUE URLReturn Value
exit status
Encode a query parameter value for GET, rather than interpolating raw text in a URL. This does not validate authorization or destination. Local mock server required.
Working Example
Example Snippetbash
[[ ${BM_API_BASE-} =~ ^http://127\.0\.0\.1:[0-9]{1,5}$ ]] || exit 2curl -q --noproxy "*" --proto "=http" -sS --connect-timeout 1 --max-time 2 --fail --get --data-urlencode 'q=daily report' "$BM_API_BASE/search"