Skip to content
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

Fix: never decode integers as Decimals #224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

azizk
Copy link

@azizk azizk commented Aug 12, 2024

It's unnecessary to decode them as Decimals with decimal: true, since integers can already be of arbitrary size, limited only by memory.

It can create issues in controllers when the Plug.Parsers plug is configured to use Poison with the :decimal option:

plug Plug.Parsers,
  parsers: [:urlencoded, :multipart, :json],
  pass: ["*/*"],
  json_decoder: {Poison, :decode!, [[decimal: true]]}

It's unnecessary to decode them as `Decimal`s with `decimal: true`,
since integers can already be of arbitrary size, limited only by memory.

It can create issues in controllers when the `Plug.Parsers` plug
is configured to use Poison with the `:decimal` option:

```elixir
plug Plug.Parsers,
  parsers: [:urlencoded, :multipart, :json],
  pass: ["*/*"],
  json_decoder: {Poison, :decode!, [[decimal: true]]}
```
@azizk
Copy link
Author

azizk commented Oct 22, 2024

Hi, Devin! I hope you're doing well! Is there a chance to get this merged or at least reviewed? I think it's important and it shouldn't sit around any longer. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant