-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicated call to Poison.Decoder.decode/2 when using Poison.decode/2 with %{as: struct} #191
Comments
devinus
added a commit
that referenced
this issue
Jun 9, 2024
Features: * Support Erlang 27 and Elixir 1.17 * Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility * Make `:html_safe` encode option follow OWASP recommended HTML escaping * Added `Date.Range` encoding * Allow `:as` decode option to be a function * Added a CHANGELOG Bug Fixes: * Stop double decoding structs * Fix various typespecs * Correctly encode some UTF-8 surrogate pairs Performance Improvements: * Significantly improved performance Breaking Changes: * Removed deprecated `HashSet` encoding * Minimum supported versions are now Erlang 24 and Elixir 1.12 Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus
added a commit
that referenced
this issue
Jun 9, 2024
Features: * Support Erlang 27 and Elixir 1.17 * Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility * Make `:html_safe` encode option follow OWASP recommended HTML escaping * Add `Date.Range` encoding * Allow `:as` decode option to be a function * Add a CHANGELOG Bug Fixes: * Stop double decoding structs * Fix various typespecs * Correctly encode some UTF-8 surrogate pairs Performance Improvements: * Significantly improve performance Breaking Changes: * Remove deprecated `HashSet` encoding * Minimum supported versions are now Erlang 24 and Elixir 1.12 Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus
added a commit
that referenced
this issue
Jun 9, 2024
Features: * Support Erlang 27 and Elixir 1.17 * Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility * Make `:html_safe` encode option follow OWASP recommended HTML escaping * Add `Date.Range` encoding * Allow `:as` decode option to be a function * Add a CHANGELOG Bug Fixes: * Stop double decoding structs * Fix various typespecs * Correctly encode some UTF-8 surrogate pairs Performance Improvements: * Significantly improve performance Breaking Changes: * Remove deprecated `HashSet` encoding * Minimum supported versions are now Erlang 24 and Elixir 1.12 Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus
added a commit
that referenced
this issue
Jun 9, 2024
Features: * Support Erlang 27 and Elixir 1.17 * Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility * Make `:html_safe` encode option follow OWASP recommended HTML escaping * Add `Date.Range` encoding * Allow `:as` decode option to be a function * Add a CHANGELOG Bug Fixes: * Stop double decoding structs * Fix various typespecs * Correctly encode some UTF-8 surrogate pairs Performance Improvements: * Significantly improve performance Breaking Changes: * Remove deprecated `HashSet` encoding * Minimum supported versions are now Erlang 24 and Elixir 1.12 Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus
added a commit
that referenced
this issue
Jun 9, 2024
Features: * Support Erlang 27 and Elixir 1.17 * Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility * Make `:html_safe` encode option follow OWASP recommended HTML escaping * Add `Date.Range` encoding * Allow `:as` decode option to be a function * Add a CHANGELOG Bug Fixes: * Stop double decoding structs * Fix various typespecs * Correctly encode some UTF-8 surrogate pairs Performance Improvements: * Significantly improve performance Breaking Changes: * Remove deprecated `HashSet` encoding * Minimum supported versions are now Erlang 24 and Elixir 1.12 Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus
added a commit
that referenced
this issue
Jun 9, 2024
Features: * Support Erlang 27 and Elixir 1.17 * Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility * Make `:html_safe` encode option follow OWASP recommended HTML escaping * Add `Date.Range` encoding * Allow `:as` decode option to be a function * Add a CHANGELOG Bug Fixes: * Stop double decoding structs * Fix various typespecs * Correctly encode some UTF-8 surrogate pairs Performance Improvements: * Significantly improve performance Breaking Changes: * Remove deprecated `HashSet` encoding * Minimum supported versions are now Erlang 24 and Elixir 1.12 Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus
added a commit
that referenced
this issue
Jun 9, 2024
Features: * Support Erlang 27 and Elixir 1.17 * Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility * Make `:html_safe` encode option follow OWASP recommended HTML escaping * Add `Date.Range` encoding * Allow `:as` decode option to be a function * Add a CHANGELOG Bug Fixes: * Stop double decoding structs * Fix various typespecs * Correctly encode some UTF-8 surrogate pairs Performance Improvements: * Significantly improve performance Breaking Changes: * Remove deprecated `HashSet` encoding * Minimum supported versions are now Erlang 24 and Elixir 1.12 Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus
added a commit
that referenced
this issue
Jun 9, 2024
Features: * Support Erlang 27 and Elixir 1.17 * Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility * Make `:html_safe` encode option follow OWASP recommended HTML escaping * Add `Date.Range` encoding * Allow `:as` decode option to be a function * Add a CHANGELOG Bug Fixes: * Stop double decoding structs * Fix various typespecs * Correctly encode some UTF-8 surrogate pairs Performance Improvements: * Significantly improve performance Breaking Changes: * Remove deprecated `HashSet` encoding * Minimum supported versions are now Erlang 24 and Elixir 1.12 Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus
added a commit
that referenced
this issue
Jun 9, 2024
Features: * Support Erlang 27 and Elixir 1.17 * Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility * Make `:html_safe` encode option follow OWASP recommended HTML escaping * Add `Date.Range` encoding * Allow `:as` decode option to be a function * Add a CHANGELOG Bug Fixes: * Stop double decoding structs * Fix various typespecs * Correctly encode some UTF-8 surrogate pairs Performance Improvements: * Significantly improve performance Breaking Changes: * Remove deprecated `HashSet` encoding * Minimum supported versions are now Erlang 24 and Elixir 1.12 Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A call to Poison.decode!/2 with
%{as: struct}
as option ends up calling:The problem is that
Poison.Decode.transform/2
ends up callingPoison.Decoder.decode/2
here. This means that any call toPoison.decode!/2
with automatic conversion to a struct will always end up callingPoison.Decoder.decode/2
twice. My suggestion would be to remove the call toPoison.Decoder.decode/2
from do_transform_struct/4 but this breaks one test.What would you suggest to avoid this problem?
The text was updated successfully, but these errors were encountered: