Граф коммитов

2 Коммитов

Автор SHA1 Сообщение Дата
Fabian Holler b94ea975f3 codes: fix: marshal/unmarshal a Code to JSON fails (#2116)
Marshalling a Code to JSON and unmarshalling it failed with an
"invalid code" error message.

Code is of type uint32. It has no custom MarshalJson() implemented
therefore it is marshalled into an JSON integer value.
The UnmarshalJSON() function expected that the marshalled Code is a
String type, unmarshalling failed.

Check in UnmarshalJSON() if the value is an uint32 in the range of the
defined Code values. If it is, unmarshal it.

This commit also adds an Marshal/Unmarshal testcase.
2018-06-01 10:56:55 -07:00
dfawley 2941ee12eb
codes: Add UnmarshalJSON support to Code type (#1720) 2017-12-11 09:02:19 -08:00