Decoder doesn't check given value type if server responses with empty type tag.
kolo opened this issue · 1 comments
kolo commented
In situation when server responses with empty type tag () decoder simply passes it without actually checking if value type in response matches value type of variable passed by user to decoder.
oz commented
Do you have an idea on how to fix this? 🎱
I actually met the case while playing with opensubtitles.org's API. Some of their API methods can return either arrays of <struct>
, or plain <struct>
replies : which mean some calls to the same function can be decoded in two different ways: this does not play very well with Go's type system I'm afraid. 😕