This project is a simple HTTP server that echoes back request information. It is useful for testing and debugging deployments and networking configurations by providing a simple interface to inspect requests.
The HTTP Echo server provides the following features:
- Accepts HTTP methods
GET
,POST
,PUT
,PATCH
andDELETE
. - Echoes back request information in
json
format:- host:
hostname
andip
- headers: request headers
- queries: query parameters
- params: path parameters
- body: request body
- host:
- Returns a custom status code for a request (provided via query).
- E.g.
http://127.0.0.1:3000/?status=404
returns a404
response code.
- E.g.
- Exports metrics in
prometheus
format for monitoring.
The server accepts the following parameters:
-listen
: the address to listen on (default::3000
)-metrics
: the path to expose metrics on (default:/metrics
)
You can run the server using via the following methods:
Yuu can run the server locally using the following command:
# execute via go run
$ go run cmd/server/main.go
# or build and execute
$ go build -o htt-echo cmd/server/main.go
$ ./http-echo
There is also a docker image available on Docker Hub.
# run using docker
$ docker run -p 3000:3000 rellyson/http-echo:latest
This project is licensed under the MIT License - see the LICENSE file for details.