MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / ReadRequestBody

Method ReadRequestBody

rpc/codec.go:43–62  ·  view source on GitHub ↗

ReadRequestBody override default rpc.ServerCodec behaviour and inject remote node id into request.

(body interface{})

Source from the content-addressed store, hash-verified

41
42// ReadRequestBody override default rpc.ServerCodec behaviour and inject remote node id into request.
43func (nc *NodeAwareServerCodec) ReadRequestBody(body interface{}) (err error) {
44 err = nc.ServerCodec.ReadRequestBody(body)
45 if err != nil {
46 return
47 }
48
49 // test if request contains rpc envelope
50 if body == nil {
51 return
52 }
53
54 if r, ok := body.(proto.EnvelopeAPI); ok {
55 // inject node id to rpc envelope
56 r.SetNodeID(nc.NodeID)
57 // inject context
58 r.SetContext(nc.Ctx)
59 }
60
61 return
62}

Callers

nothing calls this directly

Calls 2

SetNodeIDMethod · 0.65
SetContextMethod · 0.65

Tested by

no test coverage detected