4 releases
new 0.1.3 | Mar 9, 2025 |
---|---|
0.1.2 | Mar 1, 2025 |
0.1.1 | Feb 1, 2025 |
0.1.0 | Feb 1, 2025 |
#241 in Network programming
189 downloads per month
22KB
96 lines
HTTP Status Code Checker
dead simple binary to check http status code(s) returned from health-check endpoint.
Why not just use cURL?
cURL can definitively do the job as long as you are willing to mix the shell script to parse the payload. Specially if you want to cover a range of status instead of a single HTTP code.
The http_status_code_check
command removes the necessity of parsing the HTTP
status codes and let you dealing only with the program exit code itself:
- 0 - if the status code is inside the list of expected ones
- 1 - if the status code is outside the list of expected ones
Also. In a scenario where one of the containers get compromised a tool like curl can become a liability helping the intruder having an easier time fetching more external data/tools.
Install
cargo install http_status_code_check
or
curl -L https://github.com/rmoraes92/http_status_code_check/releases/download/0.1.2/http_status_code_check \
> /bin/http_status_code_check && \
chmod 755 /bin/http_status_code_check
Usage
- Checking for single code:
http_status_code_check -u http://google.com -s 200
- Checking for multiple codes:
http_status_code_check -u http://google.com -s 201,200
Example Mocking AWS ECS
An example using docker compose is located at demo/
folder.
It uses to barebones container images with the healthcheck capability of docker compose.
License
The MIT License (MIT)
Copyright © 2025 Ramon Moraes ramonmoraes.foss@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Dependencies
~5–19MB
~273K SLoC