Returns the request method and body. Accepts JSON, plain text, URL-encoded forms, and binary data.
Details
Request examples
POST · JSON
curl 'http://localhost:3000/v1/echo' \
-H 'Content-Type: application/json' \
--data-binary '{"name":"Bob"}'
POST · Plain text
curl 'http://localhost:3000/v1/echo' \
-H 'Content-Type: text/plain' \
--data-binary 'Hello!'
POST · Form
curl 'http://localhost:3000/v1/echo' \
--data-urlencode 'name=Bob' \
--data-urlencode 'age=42'
POST · Binary file
curl 'http://localhost:3000/v1/echo' \
-H 'Content-Type: application/octet-stream' \
--data-binary '@./file.bin'
Responses
200 OK
The method and parsed request body. This example is a GET request without a body.
Example · text/plain
GET
null
Example · application/json
{
"method": "GET",
"body": null
}
Schema · object
| Field | Type | Description |
|---|
methodrequired | string | The HTTP request method. |
|---|
bodyrequired | object | array | string | number | boolean | null | A JSON value, string, form fields, or binary body { encoding: 'base64', sizeBytes: number, data: string }. Null when no body is provided. |
|---|
body · binary object
| Field | Type | Description |
|---|
encodingrequired | string | Always "base64". |
|---|
sizeBytesrequired | integer | Number of original bytes. |
|---|
datarequired | string | Base64-encoded content. |
|---|
400 Bad Request
Invalid format, such as ?format=xml. This error is always returned as plain text.
Example · text/plain
Unsupported format: xml
Valid values: text, json
Example · text/plain
Unsupported format: xml
Valid values: text, json
413 Payload Too Large
The body exceeds 102,400 bytes (100 KiB).
Example · text/plain
Request body exceeds the size limit of 100 KiB
Example · application/json
{
"error": "Request body exceeds the size limit of 100 KiB",
"limitBytes": 102400
}
Schema · object
| Field | Type | Description |
|---|
errorrequired | string | Error description. |
|---|
limitBytesrequired | integer | Maximum body size in bytes. Value: 102400. |
|---|
415 Unsupported Media Type
An unsupported or missing Content-Type for a nonempty body.
Example · text/plain
Unsupported Content-Type. Supported: application/json, text/plain, application/x-www-form-urlencoded, application/octet-stream
Example · application/json
{
"error": "Unsupported Content-Type. Supported: application/json, text/plain, application/x-www-form-urlencoded, application/octet-stream"
}
Schema · object
| Field | Type | Description |
|---|
errorrequired | string | Error description. |
|---|
Invalid JSON also returns 400. Parser syntax and encoding errors currently use Express’s default HTML response regardless of the selected output format.