MCPcopy Create free account
hub / github.com/kataras/iris / ReadProtobuf

Method ReadProtobuf

context/context.go:3207–3214  ·  view source on GitHub ↗

ReadProtobuf binds the body to the "ptr" of a proto Message and returns any error. Look `ReadJSONProtobuf` too.

(ptr proto.Message)

Source from the content-addressed store, hash-verified

3205// ReadProtobuf binds the body to the "ptr" of a proto Message and returns any error.
3206// Look `ReadJSONProtobuf` too.
3207func (ctx *Context) ReadProtobuf(ptr proto.Message) error {
3208 rawData, err := ctx.GetBody()
3209 if err != nil {
3210 return err
3211 }
3212
3213 return proto.Unmarshal(rawData, ptr)
3214}
3215
3216// ProtoUnmarshalOptions is a type alias for protojson.UnmarshalOptions.
3217type ProtoUnmarshalOptions = protojson.UnmarshalOptions

Callers 2

ReadBodyMethod · 0.95
readFunction · 0.80

Calls 2

GetBodyMethod · 0.95
UnmarshalMethod · 0.65

Tested by

no test coverage detected