2 Star 11 Fork 12

联犀/中台模块

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
response.go 529 Bytes
一键复制 编辑 原始数据 按行查看 历史
杨磊 提交于 2025-03-08 22:24 +08:00 . fix: 修复websocket订阅可能只发其中一个
package websocket
import (
"encoding/json"
"net/http"
)
type response struct {
req *WsReq
resp WsResp
}
func (r *response) Header() http.Header {
ret := make(http.Header)
for k, v := range r.resp.Handler {
ret[k] = []string{v}
}
return ret
}
func (r *response) Write(buf []byte) (int, error) {
var body map[string]any
err := json.Unmarshal(buf, &body)
if err != nil {
r.resp.Body = body
return len(buf), nil
}
r.resp.Body = body
return len(buf), nil
}
func (r *response) WriteHeader(statusCode int) {
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/unitedrhino/core.git
git@gitee.com:unitedrhino/core.git
unitedrhino
core
中台模块
v1.5.0

搜索帮助