HTTP Check

HTTP Check

HTTP Check validates connectivity to an HTTP endpoint and optionally checks for specific status codes or text in the response.

Usage with Binary

./wait4it -type=http -h=https://example.com -t=60 -http-status=200 -http-text="Welcome"

Usage with Docker

docker run ph4r5h4d/wait4it -type=http -h=https://example.com -t=60 -http-status=200 -http-text="Welcome"

Environment Variables

VariableDescriptionDefault
W4IT_TYPEThe type of check (set to http for HTTP check).-
W4IT_TIMEOUTTimeout in seconds.30
W4IT_HOSTThe HTTP endpoint to check.127.0.0.1
W4IT_HTTP_STATUS_CODEExpected HTTP status code.200
W4IT_HTTP_TEXTSubstring to search for in the HTTP response.-
W4IT_HTTP_FOLLOW_REDIRECTWhether to follow redirects (true or false).true

Command-Line Arguments

ArgumentDescriptionDefault
-typeThe type of check (set to http for HTTP check).-
-tTimeout in seconds.30
-hThe HTTP endpoint to check.127.0.0.1
-http-statusExpected HTTP status code.200
-http-textSubstring to search for in the HTTP response.-
-http-follow-redirectWhether to follow redirects (true or false).true

Notes

ℹ️
  • Environment variables override command-line arguments.
  • If W4IT_HTTP_STATUS_CODE is not defined, the check defaults to expecting status code 200.
  • If W4IT_HTTP_TEXT is not defined, only the status code is checked.

Exit Codes

CodeMeaning
0Connection successful.
1Timed out.
2Validation error or incorrect input.