HTTP 方法介绍
涵盖常用方法与新发布的 QUERY 方法。徽章标注每个方法是否 safe / idempotent / cacheable / 允许 body。
QUERYNEW
带请求体的安全查询方法——“带 body 的 GET”。
safe ✓idempotent ✓cacheable ✓body ✓
GET
获取资源,不应产生副作用。
safe ✓idempotent ✓cacheable ✓body ✗
POST
提交数据,通常创建资源或触发处理。
safe ✗idempotent ✗cacheable ✗body ✓
PUT
整体替换目标资源。
safe ✗idempotent ✓cacheable ✗body ✓
PATCH
对资源做部分修改。
safe ✗idempotent ✗cacheable ✗body ✓
DELETE
删除目标资源。
safe ✗idempotent ✓cacheable ✗body ✗
HEAD
与 GET 相同但只返回响应头,无 body。
safe ✓idempotent ✓cacheable ✓body ✗
OPTIONS
查询目标资源支持的通信选项。
safe ✓idempotent ✓cacheable ✗body ✗
TRACE
HTTP TRACE 沿请求路径执行回环诊断测试,可暴露中间代理对请求的修改。因存在安全风险,生产环境通常禁用。
safe ✓idempotent ✓cacheable ✗body ✗
CONNECT
HTTP CONNECT 通过代理建立 TCP 隧道,用于 HTTPS 及其他协议的隧道传输。涵盖隧道流程、代理行为与安全考量。
safe ✗idempotent ✗cacheable ✗body ✗