ReadProtobuf binds the body to the "ptr" of a proto Message and returns any error. Look `ReadJSONProtobuf` too.
(ptr proto.Message)
| 3205 | // ReadProtobuf binds the body to the "ptr" of a proto Message and returns any error. |
| 3206 | // Look `ReadJSONProtobuf` too. |
| 3207 | func (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. |
| 3217 | type ProtoUnmarshalOptions = protojson.UnmarshalOptions |