curl
External HTTP client, tested with curl 8.14.1. Use -q first to ignore default curl configuration, -sS for diagnostics without progress, -o for body bytes, -w for metadata, --connect-timeout for connection setup and --max-time for individual transfer. Exit status alone does not establish HTTP or application success. For remote services use verified HTTPS; this example is loopback HTTP only.
Formal Syntax & Structure
curl [OPTIONS] URLParameters & Attributes
| Name | Type | Description |
|---|---|---|
| URL | string | Trusted endpoint URL |
Return Value
External HTTP client, tested with curl 8.14.1. Use -q first to ignore default curl configuration, -sS for diagnostics without progress, -o for body bytes, -w for metadata, --connect-timeout for connection setup and --max-time for individual transfer. Exit status alone does not establish HTTP or application success. For remote services use verified HTTPS; this example is loopback HTTP only.
Working Example
[[ ${BM_API_BASE-} =~ ^http://127\.0\.0\.1:[0-9]{1,5}$ ]] || exit 2for route in ok missing; do code=$(curl -q --noproxy "*" --proto "=http" -sS --connect-timeout 1 --max-time 2 -o body.json -w '%{http_code}' "$BM_API_BASE/$route") rc=$? (( rc == 0 )) || exit "$rc" printf 'curl=%s http=%s\n' "$rc" "$code" cat body.jsondone