Advanced Echo Server Logo

Advanced Echo Server

Go-powered testing, load simulation & chaos engineering

Custom Responses

Customize HTTP responses with status codes, response sizes, compression, content types, and headers using HTTP headers or environment variables.

How It Works

graph TD
  A[Receive Request] --> B{Check Headers/Env}
  B --> C[Set Status Code]
  B --> D[Set Response Size]
  B --> E[Apply Compression]
  B --> F[Set Content-Type]
  B --> G[Add Custom Headers]
  B --> H[Include Server Info]
  C --> I[Generate Response]
  D --> I
  E --> I
  F --> I
  G --> I
  H --> I
  I --> J[Respond]

Custom Status Code

Override the default 200 status code.

curl -H "X-Echo-Status: 201" http://localhost:8080/
# Response: HTTP 201 Created

Response Size

Generate a response of specific size (bytes) with random data.

curl -H "X-Echo-Response-Size: 1024" http://localhost:8080/
# Response: 1KB of random data

Compression

Enable GZIP compression for responses.

curl -H "X-Echo-Compress: gzip" --compressed http://localhost:8080/
# Response: GZIP-compressed body

Content-Type

Override the response Content-Type.

curl -H "X-Echo-Content-Type: application/xml" http://localhost:8080/
# Response: Content-Type: application/xml

Custom Headers

Add or echo custom headers in responses.

curl -H "X-Echo-Set-Header-Custom: value" http://localhost:8080/
# Response Headers: Custom: value

Server Info

Include server details (uptime, hostname, version).

curl -i -H "X-Echo-Server-Info: true" http://localhost:8080/
# ...
# X-Echo-Server: 
# X-Echo-Version: 1.0.0
# X-Echo-Uptime: 1h2m3s

Notes