[#127] apistatus: Support WRONG_MAGIC_NUMBER status

Define `WrongMagicNumber` type for which encapsulates the work with
incorrect network magic. Provide method to read/write the correct magic
(which is a status detail in NeoFS API V2 protocol).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-01-25 15:37:30 +03:00 committed by Alex Vanin
parent 883a26d210
commit 0fb22361a3
6 changed files with 121 additions and 3 deletions

View file

@ -49,6 +49,16 @@ func TestToStatusV2(t *testing.T) {
}),
codeV2: 1024,
},
{
status: (statusConstructor)(func() apistatus.Status {
var st apistatus.WrongMagicNumber
st.WriteCorrectMagic(322)
return st
}),
codeV2: 1025,
},
} {
var st apistatus.Status
@ -117,6 +127,16 @@ func TestFromStatusV2(t *testing.T) {
}),
codeV2: 1024,
},
{
status: (statusConstructor)(func() apistatus.Status {
var st apistatus.WrongMagicNumber
st.WriteCorrectMagic(322)
return st
}),
codeV2: 1025,
},
} {
var st apistatus.Status