Supabase.Fetcher.Response (supabase_potion v0.6.1)

Defines a common structure to operate on HTTP responses from different HTTP clients backends and also defines helper functions to operate this same structure

Summary

Functions

Helper function to get a specific header value from a response.

Types

t()

@type t() :: %Supabase.Fetcher.Response{
  body: Supabase.Fetcher.body(),
  headers: Supabase.Fetcher.headers(),
  status: Supabase.Fetcher.status()
}

Functions

decode_body(resp, decoder \\ Supabase.Fetcher.JSONDecoder, opts \\ [])

@spec decode_body(t(), module() | nil | fun(), decoder_opts :: keyword()) ::
  Supabase.result(t())

Helper function to directly decode the body using a Supabase.Fetcher.BodyDecoder

get_header(response, header)

@spec get_header(t(), String.t()) :: String.t() | nil

Helper function to get a specific header value from a response.

get_header(resp, header, default)

@spec get_header(t(), String.t(), String.t()) :: String.t() | nil