ReadJSONProtobuf reads a JSON body request into the given "ptr" proto.Message. Look `ReadProtobuf` too.
(ptr proto.Message, opts ...ProtoUnmarshalOptions)
| 3221 | // ReadJSONProtobuf reads a JSON body request into the given "ptr" proto.Message. |
| 3222 | // Look `ReadProtobuf` too. |
| 3223 | func (ctx *Context) ReadJSONProtobuf(ptr proto.Message, opts ...ProtoUnmarshalOptions) error { |
| 3224 | rawData, err := ctx.GetBody() |
| 3225 | if err != nil { |
| 3226 | return err |
| 3227 | } |
| 3228 | |
| 3229 | opt := defaultProtobufUnmarshalOptions |
| 3230 | if len(opts) > 0 { |
| 3231 | opt = opts[0] |
| 3232 | } |
| 3233 | |
| 3234 | return opt.Unmarshal(rawData, ptr) |
| 3235 | } |
| 3236 | |
| 3237 | // ReadMsgPack binds the request body of msgpack format to the "ptr" and returns any error. |
| 3238 | func (ctx *Context) ReadMsgPack(ptr interface{}) error { |
no test coverage detected