forked from TrueCloudLab/frostfs-api-go
[#168] session: Implement binary/JSON encoders/decoders on ResponseVerify
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
edf6ec05b3
commit
6456fcf8fa
4 changed files with 45 additions and 4 deletions
|
@ -164,3 +164,23 @@ func (r *ResponseMetaHeader) UnmarshalJSON(data []byte) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *ResponseVerificationHeader) MarshalJSON() ([]byte, error) {
|
||||
return protojson.MarshalOptions{
|
||||
EmitUnpopulated: true,
|
||||
}.Marshal(
|
||||
ResponseVerificationHeaderToGRPCMessage(r),
|
||||
)
|
||||
}
|
||||
|
||||
func (r *ResponseVerificationHeader) UnmarshalJSON(data []byte) error {
|
||||
msg := new(session.ResponseVerificationHeader)
|
||||
|
||||
if err := protojson.Unmarshal(data, msg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*r = *ResponseVerificationHeaderFromGRPCMessage(msg)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue