MCPcopy
hub / github.com/TarsCloud/TarsGo / response2Bytes

Function response2Bytes

tars/protocol/push/server.go:78–88  ·  view source on GitHub ↗
(rsp *requestf.ResponsePacket)

Source from the content-addressed store, hash-verified

76}
77
78func response2Bytes(rsp *requestf.ResponsePacket) []byte {
79 os := codec.NewBuffer()
80 rsp.WriteTo(os)
81 bs := os.ToBytes()
82 sbuf := bytes.NewBuffer(nil)
83 sbuf.Write(make([]byte, 4))
84 sbuf.Write(bs)
85 len := sbuf.Len()
86 binary.BigEndian.PutUint32(sbuf.Bytes(), uint32(len))
87 return sbuf.Bytes()
88}

Callers 2

SendFunction · 0.85
InvokeMethod · 0.85

Calls 5

ToBytesMethod · 0.95
LenMethod · 0.95
NewBufferFunction · 0.92
WriteMethod · 0.65
WriteToMethod · 0.45

Tested by

no test coverage detected