Bier.Negotiation (bier v0.1.0)

Copy Markdown View Source

Resolves the response media type for a request by negotiating the Accept header against the producers available in the request's context (relation, RPC, or root), mirroring PostgREST's content negotiation.

Returns {:ok, %Bier.MediaType{}} or {:error, {:not_acceptable, accept}} where accept is the original Accept header (used to build the PGRST107 error message).

Summary

Functions

The raw Accept header (or nil).

Negotiate for a request given the list of available producer symbols. available is an ordered list; its head is the default for */*.

Functions

accept(conn)

The raw Accept header (or nil).

resolve(conn, available)

Negotiate for a request given the list of available producer symbols. available is an ordered list; its head is the default for */*.