Simple Echo
The core functionality of Advanced Echo Server is to mirror incoming HTTP requests. The server echoes the request body for non-GET requests and provides detailed request information for empty GET requests. It automatically adds X-Request-ID and X-Echo-Request-Count headers to track requests.
How It Works
graph TD
A[Receive Request] --> B{Check Method}
B -->|GET, No Body| C[Return Request Info]
B -->|Other Methods| D[Echo Request Body]
C --> E[Add X-Request-ID, X-Echo-Request-Count]
D --> E
E --> F[Respond with Content-Type]
Echoing Request Body
For POST, PUT, PATCH, etc., the server echoes the request body with the same Content-Type (or text/plain if unspecified).
- Endpoint:
ANY / - Example:
curl -X POST http://localhost:8080/ -H "Content-Type: application/json" -d '{"message": "hello"}'
# Response: {"message": "hello"}
# Headers: X-Request-ID: , X-Echo-Request-Count:
Request Info for GET
For GET requests with no body, the server returns a plain-text summary of the request (method, URI, headers, client IP, timestamp).
- Endpoint:
GET / - Example:
curl http://localhost:8080/
# Response:
# GET / HTTP/1.1
# Host: localhost:8080
# User-Agent: curl/7.68.0
# Accept: */*
# Client-IP: 127.0.0.1
# Timestamp: 2025-09-14T20:03:00Z
Notes
- Request bodies are limited by
MAX_BODY_SIZE(default 10MB). X-Request-IDis auto-generated if not provided and echoed back in response.- Requests are logged if
LOG_REQUESTS=true(printsremote method pathand a completion line withstatusandduration). SetLOG_HEADERSto include headers andLOG_BODYto include request body (skipped for/sse; truncated byMAX_LOG_BODY_SIZE). EnableLOG_TRANSACTION=trueto print a consolidated request+response transaction block (SSE bodies omitted; bodies truncated byMAX_LOG_BODY_SIZE). Response logging can be enabled viaLOG_RESPONSEwithLOG_RESPONSE_HEADERS/LOG_RESPONSE_BODY(body truncated byMAX_LOG_BODY_SIZEand skipped for/sse).