http-echo is a small HTTP server that returns the current server time for
each request.
- Go 1.27 or later to build from source
- Linux (x64 or arm64), macOS (x64 or arm64), or Windows (x64) to run the compiled binary
Build the executable locally:
mkdir -p bin
go build -o bin/httpecho .Move bin/httpecho (or httpecho.exe on Windows) to a directory on your
PATH, then check the available commands:
httpecho --helpStart the server:
httpecho serverIt listens on :8085 by default. Change the address with --address (or
-H) or the HTTP_ECHO_ADDRESS environment variable:
httpecho server --address :8080
curl http://localhost:8080/The root endpoint returns the current time as text. Send
Content-Type: application/json to receive a JSON response. The server also
provides /queue and Prometheus metrics at /metrics.
To require the X-Auth-Token header on incoming requests, set --auth-token
(or HTTP_ECHO_AUTH_TOKEN):
httpecho server --auth-token change-meRun the test suite:
go test ./...Build a development binary with the repository helper:
./hack/build.shThe binary is written to bin/httpecho.
This project follows Semantic Versioning.