MCPcopy
hub / github.com/grpc/grpc-go / decodeGrpcMessage

Function decodeGrpcMessage

internal/transport/http_util.go:268–279  ·  view source on GitHub ↗

decodeGrpcMessage decodes the msg encoded by encodeGrpcMessage.

(msg string)

Source from the content-addressed store, hash-verified

266
267// decodeGrpcMessage decodes the msg encoded by encodeGrpcMessage.
268func decodeGrpcMessage(msg string) string {
269 if msg == "" {
270 return ""
271 }
272 lenMsg := len(msg)
273 for i := 0; i < lenMsg; i++ {
274 if msg[i] == percentByte && i+2 < lenMsg {
275 return decodeGrpcMessageUnchecked(msg)
276 }
277 }
278 return msg
279}
280
281func decodeGrpcMessageUnchecked(msg string) string {
282 var sb strings.Builder

Callers 4

TestDecodeGrpcMessageMethod · 0.85
operateHeadersMethod · 0.85

Calls 1

Tested by 3

TestDecodeGrpcMessageMethod · 0.68