Test an HTTP endpoint's status
Read-only
What do risk levels mean?
- Read-only
- Inspects state without changing anything.
- Low risk
- Reversible with a routine follow-up command.
- Medium risk
- Changes state; undo path documented.
- Destructive
- Deletes or overwrites; confirmation required.
Sends a request to a URL and prints the HTTP status code, following redirects, to quickly confirm whether an endpoint is up and healthy.
networkhttpcurlhealth-check
Parameters
Full URL to request, including the scheme.
Commands
Request the URL, follow redirects, and print the final status code
curl -sS -L -o /dev/null -w "%{http_code}\n" <url>Verification
curl -sS -L -o /dev/null -w "%{http_code}\n" <url>A 2xx code means healthy; 000 means the connection itself failed (DNS, TLS, or refused).
Undo
Not undoable
This recipe only sends a request and changes nothing locally.
Pitfalls
- This sends a GET; endpoints that mutate state on GET violate HTTP semantics but do exist, so know the endpoint before probing production.
- Use curl.exe on Windows PowerShell (for the verification command too, with -o NUL) — bare "curl" is an alias for Invoke-WebRequest, which does not understand these flags.
- A healthy status code does not validate the response body; add a body check for deeper health verification.