Packages

Integration with the Auth API from Supabase services. Provide authentication with MFA, password and magic link.

Current section

Files

Jump to
supabase_auth lib supabase auth request json_decoder.ex
Raw

lib/supabase/auth/request/json_decoder.ex

defmodule Supabase.Auth.Request.JSONDecoder do
@moduledoc """
A body decoder that transforms empty response to a valid map.
"""
@behaviour Supabase.Fetcher.BodyDecoder
alias Supabase.Fetcher.Response
@impl true
def decode(%Response{body: body}, _ \\ []) do
body = if body == "", do: "{}", else: body
Supabase.decode_json(body)
end
end