Yasumu LogoYasumu

Echo Server

Built-in echo server for testing HTTP clients and requests.

Echo Server

The Tanxium Echo Server is a built-in utility for testing HTTP clients, similar to Postman Echo or Bruno's echo service. It mirrors back your request details, making it perfect for debugging and development.

The echo server is available at http://echo.yasumu.local when Yasumu is running.

Overview

The echo server intercepts requests to any path (except specific helper endpoints) and returns a JSON response containing details about the request you sent. This is useful for:

  • Debugging request configurations
  • Verifying headers and authentication
  • Testing request body parsing
  • Validating query parameters
  • Simulating various server conditions

Basic Usage

Send any HTTP request to the echo server:

POST /any/path?foo=bar
Host: echo.yasumu.local
Content-Type: application/json

{ "key": "value" }

Response Structure

The server responds with a JSON object containing your request details:

{
  "url": "http://echo.yasumu.local/any/path?foo=bar",
  "path": "/any/path",
  "method": "POST",
  "headers": {
    "host": "echo.yasumu.local",
    "content-type": "application/json"
  },
  "args": {
    "foo": "bar"
  },
  "cookies": {},
  "body": {
    "key": "value"
  },
  "json": {
    "key": "value"
  },
  "form": null,
  "files": {},
  "data": null,
  "meta": {
    "timestamp": "2024-01-15T12:00:00.000Z",
    "source": "tanxium-echo-server"
  }
}

Response Fields

FieldDescription
urlFull request URL
pathRequest path without query string
methodHTTP method used
headersAll request headers
argsQuery parameters as key-value pairs
cookiesParsed cookies
bodyRaw request body
jsonParsed JSON body (if applicable)
formParsed form data (if applicable)
filesUploaded files (multipart)
metaServer metadata

Simulation Parameters

Control server behavior by adding query parameters to any request.

Latency Simulation (?delay=ms)

Add artificial delay to simulate slow network conditions:

GET /test?delay=2000
Host: echo.yasumu.local

The server waits 2000ms (2 seconds) before responding.

Status Codes (?status=code)

Force the server to respond with a specific HTTP status code:

GET /test?status=404
Host: echo.yasumu.local

Returns 404 Not Found.

Rejection (?reject=true)

Simulate a server error immediately:

GET /test?reject=true
Host: echo.yasumu.local

Returns 500 Internal Server Error.

Combining Parameters

Parameters can be combined:

GET /test?delay=1000&status=201
Host: echo.yasumu.local

Waits 1 second, then returns 201 Created.

Helper Endpoints

IP Address

Returns the client's IP address:

GET /ip
Host: echo.yasumu.local

Basic Authentication

Tests Basic Authentication headers:

GET /basic-auth
Host: echo.yasumu.local
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Bearer Authentication

Tests Bearer Token headers:

GET /bearer-auth
Host: echo.yasumu.local
Authorization: Bearer my-secret-token

HTTP Methods

The echo server supports all standard HTTP methods:

MethodDescription
GETRetrieve (no body expected)
POSTCreate (body expected)
PUTUpdate/replace
PATCHPartial update
DELETERemove
HEADHeaders only
OPTIONSCORS preflight

Content Types

The server correctly parses various content types:

JSON

POST /test
Content-Type: application/json

{"name": "John", "age": 30}

Form Data

POST /test
Content-Type: application/x-www-form-urlencoded

name=John&age=30

Multipart

POST /test
Content-Type: multipart/form-data; boundary=----FormBoundary

------FormBoundary
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain

File contents here
------FormBoundary--

On this page