Documentation
¶
Overview ¶
Package httpapi is the HTTP frontend, implemented on the standard library only (net/http with method-pattern routing). It turns the registry's HTTP hints into routes:
- HTTPHints.Method + Path define the route; path placeholders {name} map to fields tagged http:"path" (via r.PathValue).
- 未标注 http 位置或标注 http:"query" 的字段默认从 query 绑定; http:"header"(httpName)从请求头绑定;JSON body 合并为入参基底。
- Responses are bare JSON (no envelope), the same shape as CLI --json; errors map to HTTP status codes through the shared error taxonomy.
- GET /openapi.json exposes an OpenAPI 3 document generated from the same InputSchema the MCP frontend uses.
Entries without HTTP hints are not routed. This package pulls zero third-party dependencies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORS ¶
CORS wraps h with permissive-allowlist CORS handling: requests whose Origin matches an entry in origins (or "*" for any origin) get the Access-Control-Allow-Origin header, and OPTIONS preflights are answered with 204 before reaching the inner handler. Empty origins disables CORS.
Types ¶
This section is empty.