/ˌeɪtʃ tiː tiː ˈpɒd/: a simple HTTP Request & Response Service written in go, shamelessly stolen from httpbin.
Like the famous httpbin
this service provides several API's for testing HTTP requests and a
corresponding swagger GUI. It adds some features helpful for testing in kubernetes or istio environments:
- With environment variable
BASE_PATH
, a "context root" can be configured. This is helpful if routing is done via path prefix. - The service handles
X-Forwarded-Host
andX-Forwarded-Prefix
headers. This is helpful, if ingress controller or virtual services rewrite the destination path.
- HTTP Methods: Testing DELETE, GET, PATCH, POST and PUT requests. TODO: add url parameters
- Status codes: Generates responses with given status code
- Cookies: Creates, reads and deletes cookies
- JWT: Show and validated JWT Bearer Token
# Download swag once:
go install github.com/swaggo/swag/cmd/swag@latest
# Create swagger info
swag init -g cmd/main.go -o internal/docs
# Run
go run cmd/main.go
# Open browser on http://localhost:8080/swagger/index.html
Two docker images are available:
- latest: based on
ubuntu
. This is mainly for debugging purpose (i.e. running curl in running container) - latest-slim: scratch image only containing the binary
docker pull ghcr.io/tgunsch/httpod:latest-slim
# Access http://localhost:8080/swagger/index.html
docker run --rm -p 8080:8080 ghcr.io/tgunsch/httpod:latest-slim
# Access http://localhost:8080/httpod/swagger/index.html
docker run --rm -p 8080:8080 -e BASE_PATH=httpod ghcr.io/tgunsch/httpod:latest-slim