请求示例
POST · JSON
curl https://200ok.hacks.run/echo \
-H 'Content-Type: application/json' \
--data-binary '{"name":"Bob"}'
POST · 纯文本
curl https://200ok.hacks.run/echo \
-H 'Content-Type: text/plain' \
--data-binary 'Hello!'
POST · 表单
curl https://200ok.hacks.run/echo \
--data-urlencode 'name=Bob' \
--data-urlencode 'age=42'
POST · 二进制文件
curl https://200ok.hacks.run/echo \
-H 'Content-Type: application/octet-stream' \
--data-binary '@./file.bin'
响应
200 OK
请求方法和解析后的请求体。此示例是没有请求体的 GET 请求。
示例 · application/json
{"method":"GET","body":null}
结构 · object
| 字段 | 类型 | 描述 |
|---|
method必填 | string | 请求的 HTTP 方法。 |
|---|
body必填 | object | array | string | number | boolean | null | JSON 值、字符串、表单字段或二进制请求体 { encoding: 'base64', sizeBytes: number, data: string }。未提供请求体时为 null。 |
|---|
body · 二进制对象
| 字段 | 类型 | 描述 |
|---|
encoding必填 | string | 始终 "base64". |
|---|
sizeBytes必填 | integer | 原始字节数。 |
|---|
data必填 | string | Base64 编码的内容。 |
|---|
示例 · application/json
{
"method": "GET",
"body": null
}
结构 · object
| 字段 | 类型 | 描述 |
|---|
method必填 | string | 请求的 HTTP 方法。 |
|---|
body必填 | object | array | string | number | boolean | null | JSON 值、字符串、表单字段或二进制请求体 { encoding: 'base64', sizeBytes: number, data: string }。未提供请求体时为 null。 |
|---|
body · 二进制对象
| 字段 | 类型 | 描述 |
|---|
encoding必填 | string | 始终 "base64". |
|---|
sizeBytes必填 | integer | 原始字节数。 |
|---|
data必填 | string | Base64 编码的内容。 |
|---|
413 Payload Too Large
请求体超过 102,400 字节(100 KiB)。
示例 · text/plain
Request body exceeds the size limit of 100 KiB
示例 · application/json
{"error":"Request body exceeds the size limit of 100 KiB","limitBytes":102400}
结构 · object
| 字段 | 类型 | 描述 |
|---|
error必填 | string | 错误描述。 |
|---|
limitBytes必填 | integer | 请求体的最大字节数。 值: 102400. |
|---|
示例 · application/json
{
"error": "Request body exceeds the size limit of 100 KiB",
"limitBytes": 102400
}
结构 · object
| 字段 | 类型 | 描述 |
|---|
error必填 | string | 错误描述。 |
|---|
limitBytes必填 | integer | 请求体的最大字节数。 值: 102400. |
|---|
415 Unsupported Media Type
非空请求体的 Content-Type 不受支持或缺失。
示例 · text/plain
Unsupported Content-Type. Supported: application/json, text/plain, application/x-www-form-urlencoded, application/octet-stream
示例 · application/json
{"error":"Unsupported Content-Type. Supported: application/json, text/plain, application/x-www-form-urlencoded, application/octet-stream"}
结构 · object
示例 · application/json
{
"error": "Unsupported Content-Type. Supported: application/json, text/plain, application/x-www-form-urlencoded, application/octet-stream"
}
结构 · object
无效的 JSON 会返回 400。API 错误使用所选输出格式:纯文本或 JSON。