poison
poison copied to clipboard
Duplicated call to Poison.Decoder.decode/2 when using Poison.decode/2 with %{as: struct}
A call to Poison.decode!/2 with %{as: struct} as option ends up calling:
The problem is that Poison.Decode.transform/2 ends up calling Poison.Decoder.decode/2 here. This means that any call to Poison.decode!/2 with automatic conversion to a struct will always end up calling Poison.Decoder.decode/2 twice. My suggestion would be to remove the call to Poison.Decoder.decode/2 from do_transform_struct/4 but this breaks one test.
What would you suggest to avoid this problem?