Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ if config_env() == :dev do
base_url: System.fetch_env!("SUPABASE_URL"),
api_key: System.fetch_env!("SUPABASE_KEY"),
env: config_env()

config :supabase, json_library: JSON
end
6 changes: 3 additions & 3 deletions lib/supabase.ex
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ defmodule Supabase do
apply(__MODULE__, which, [])
end

@json_library Application.compile_env(:supabase, :json_library, Jason)

@doc "Returns the configured JSON encoding library for Supabase libraries."
def json_library do
Application.get_env(:supabase, :json_library, Jason)
end
def json_library, do: @json_library
end
5 changes: 2 additions & 3 deletions lib/supabase/fetcher/body_decoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ defmodule Supabase.Fetcher.JSONDecoder do

@doc "Tries to decode the response body as JSON"
@impl true
def decode(%Response{body: body}, opts \\ []) do
keys = Keyword.get(opts, :keys, :strings)
Supabase.json_library().decode(body, keys: keys)
def decode(%Response{body: body}, _) do
Supabase.json_library().decode(body)
end
end