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