MCPcopy Create free account
hub / github.com/astercloud/aster / writeJSON

Function writeJSON

pkg/server/server.go:462–466  ·  view source on GitHub ↗

writeJSON 帮助函数: 设置正确的响应头并编码 JSON。

(w http.ResponseWriter, status int, v any)

Source from the content-addressed store, hash-verified

460
461// writeJSON 帮助函数: 设置正确的响应头并编码 JSON。
462func writeJSON(w http.ResponseWriter, status int, v any) {
463 w.Header().Set("Content-Type", "application/json; charset=utf-8")
464 w.WriteHeader(status)
465 _ = json.NewEncoder(w).Encode(v)
466}
467
468// ChatStreamHandler 提供基于 Server-Sent Events (SSE) 的流式 Chat 接口。
469//

Callers 9

ChatHandlerMethod · 0.70
TextEvalHandlerMethod · 0.70
SessionEvalHandlerMethod · 0.70
BatchEvalHandlerMethod · 0.70

Calls 1

SetMethod · 0.65

Tested by

no test coverage detected