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

Default Tesla.Middleware.JSON engine to JSON module for Elixir 1.18 #743

Open
Wigny opened this issue Jan 2, 2025 · 0 comments
Open

Default Tesla.Middleware.JSON engine to JSON module for Elixir 1.18 #743

Wigny opened this issue Jan 2, 2025 · 0 comments

Comments

@Wigny
Copy link

Wigny commented Jan 2, 2025

Currently Tesla.Middleware.JSON defaults to Jason as its JSON decoder and encoder, but since Elixir 1.18 now there is a built-in alternative that could be used as the default engine when running in Elixit 1.18, eliminating a dependency on another library.

Right now, to use the new module, I believe we could use the encode and decode options, but it cannot be directly passed in the engine option since JSON does not have an encode/1 function and also do not support engine_opts.

{Tesla.Middleware.JSON, encode: &{:ok, JSON.encode!(&1)}, decode: &JSON.decode/1 }
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

No branches or pull requests

1 participant