
Simple HTTP Server for testing
# go install
go install github.com/ryodocx/testserver@latest
# docker
docker run --rm -it -p 8080:8080 ghcr.io/ryodocx/testserver
| path |
description |
/ |
return 200 OK + any text configured with RESPONSE_BODY |
/echo |
return HTTP request information (support parse JWT authorization header) |
| env |
default |
example |
description |
| LISTEN_ADDR |
0.0.0.0:8080 |
127.0.0.1:8080 |
Listen address |
| STARTUP_WAIT |
0s |
3s |
Waiting time before start serving |
| RESPONSE_BODY |
I'm a testserver |
hello world |
HTTP response body |
| RESPONSE_SLEEP |
50ms |
0 (without sleep) 200ms 5s 0.01h |
Wait time at HTTP response |
| TRAP_SIGNALS |
[interrupt terminated] |
0 (disable graceful shutdown) 1,2,15 (enable graceful shutdown for SIGHUP/SIGINT/SIGTERM at Linux) |
Trapped Signals for graceful shutdown |
| GRACE_PERIOD_BEFORE_SHUTDOWN |
1s |
0 (no wait) 5s 1m |
Grace period before starting shutdown (ignored when TRAP_SIGNALS=0) |
| GRACE_PERIOD_DURING_SHUTDOWN |
0 (unlimited) |
0 (unlimited) 5s 1m |
Grace period during shutdown (ignored when TRAP_SIGNALS=0) |
| ACCESS_LOG |
false |
true |
If true, enable access logging |