Read the docs : https://ealenn.github.io/Echo-Server - Read the release notes
An echo server is a server that replicates the request sent by the client and sends it back.
Available:
- GET / POST / PUT / PATCH / DELETE
- Request (Query, Body, IPs, Host, Urls...)
- Request Headers / Response Headers
- Environment variables
- Control via Headers/Query
- Folders and Files
Docker OS/ARCH :
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/386
- Echo-Server / Docker / Kubernetes / Helm
| Environment | Helm | CLI | Default |
|---|---|---|---|
| PORT | service.port | --port | 80 |
| LOGS__IGNORE__PING | application.logs.ignore.ping | --logs:ignore:ping | false |
| ENABLE__HOST | application.enable.host | --enable:host | true |
| ENABLE__HTTP | application.enable.http | --enable:http | true |
| ENABLE__REQUEST | application.enable.request | --enable:request | true |
| ENABLE__HEADER | application.enable.header | --enable:header | true |
| ENABLE__ENVIRONMENT | application.enable.environment | --enable:environment | true |
| ENABLE__FILE | application.enable.file | --enable:file | true |
I use jq for nice curl results ;)
| Query | Header | Content | Conditions |
|---|---|---|---|
| ?echo_code= | X-ECHO-CODE | HTTP code 200, 404 |
200 <= CODE <= 599 |
404-401 or 200-500-301 |
|||
| ?echo_body= | X-ECHO-BODY | Body message | |
| ?echo_env_body= | X-ECHO-ENV-BODY | The key of environment variable | Enable environment true |
| ?echo_header= | X-ECHO-HEADER | Response Header Lang: en-US |
Enable header true |
| ?echo_time= | X-ECHO-TIME | Wait time in ms |
0 <= TIME <= 30.000 |
| ?echo_file= | X-ECHO-FILE | Path of Directory or File | Enable file true |
ECHO_HOST = localhost:3000 or echoserver.cluster.local for Kubernetes by default.
➜ curl -I --header 'X-ECHO-CODE: 404' $ECHO_HOST
➜ curl $ECHO_HOST/?echo_code=404
HTTP/1.1 404 Not Found➜ curl -I --header 'X-ECHO-CODE: 404-300' $ECHO_HOST
➜ curl $ECHO_HOST/?echo_code=404-300
HTTP/1.1 404 Not Found
HTTP/1.1 300 Multiple Choices➜ for i in {1..10}
➜ do
➜ curl -I $ECHO_HOST/?echo_code=200-400-500
➜ done
HTTP/1.1 500 Internal Server Error
HTTP/1.1 400 Bad Request
HTTP/1.1 200 OK
HTTP/1.1 500 Internal Server Error
HTTP/1.1 200 OK
HTTP/1.1 500 Internal Server Error➜ curl --header 'X-ECHO-BODY: amazing' $ECHO_HOST
➜ curl $ECHO_HOST/?echo_body=amazing
"amazing"➜ curl --header 'X-ECHO-ENV-BODY: HOSTNAME' $ECHO_HOST
➜ curl $ECHO_HOST/?echo_env_body=HOSTNAME
"c53a9ed79fa2"➜ for i in {1..10}
➜ do
➜ curl $ECHO_HOST/?echo_env_body=HOSTNAME
➜ done
"c53a9ed79fa2"
"f10c3af61e40"
"c53a9ed79fa2"
"f10c3af61e40"
"c53a9ed79fa2"➜ curl --header 'X-ECHO-HEADER: One:1' $ECHO_HOST
➜ curl $ECHO_HOST/?echo_header=One:1
HTTP/1.1 200 OK
One: 1➜ curl --header 'X-ECHO-HEADER: One:1, Two:2' $ECHO_HOST
➜ curl "$ECHO_HOST/?echo_header=One:1,%20Two:2"
HTTP/1.1 200 OK
One: 1
Two: 2➜ curl --header 'X-ECHO-TIME: 5000' $ECHO_HOST
➜ curl "$ECHO_HOST/?echo_time=5000"
⏳... 5000 ms➜ curl --header 'X-ECHO-FILE: /' $ECHO_HOST
➜ curl "$ECHO_HOST/?echo_file=/"
["app", "bin", "etc", "usr", "var"]➜ curl --header 'X-ECHO-CODE: 401' --header 'X-ECHO-BODY: Oups' $ECHO_HOST
➜ curl "$ECHO_HOST/?echo_body=Oups&echo_code=401"
HTTP/1.1 401 Unauthorized
"Oups"docker run -p 3000:80 ealen/echo-serverversion: '3'
services:
echo-server:
image: ealen/echo-server:latest
environment:
- ENABLE__ENVIRONMENT=false
ports:
- 3000:80curl -sL https://raw.githubusercontent.com/Ealenn/Echo-Server/master/docs/examples/echo.kube.yaml | kubectl apply -f -helm repo add ealenn https://ealenn.github.io/charts
helm repo update
helm install --set ingress.enable=true --name echoserver ealenn/echo-serverPlease read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the GNU Lesser General Public License - see the LICENSE.md file for details.
npm install
node ./src/webserver --port 3000
# OR
PORT=3000 npm run startcd ./docs
docker compose upnpm install
# Without code coverage
npm run test
# With code coverage
npm run test-with-coveragegit log --pretty=oneline=> https://github.com/Ealenn/charts/tree/master/charts/echo-server

