# `PgRest.Request.Accept`
[🔗](https://github.com/agoodway/pgrest/blob/v0.2.0/lib/pg_rest/request/accept.ex#L1)

Parses an `Accept` header into `PgRest.MediaType`s, PostgREST's `Accept` handling.

The header is split on `,` outside double quotes; each type's parameters on `;` outside
quotes. As in wai (PostgREST), spaces are dropped and a lowercase `;q=` ends the type: its value
(default `1.0`) orders the types, highest first, ties going to the more specific type
(parameters count for it, `*` against) and then to header order.
Parameters read: `nulls=stripped` (on `application/vnd.pgrst.array` and
`application/vnd.pgrst.object` only; the name is case-insensitive, the value may be quoted and
is case-sensitive), and for the plan type `for="<media type>"` and
`options=<name>|<name>` (an empty value or a trailing `;` is fine: supabase-js sends
`options=;`). Unknown plan options are ignored. A missing header is `*/*`, an empty one no
type at all (which `PgRest.Negotiate` answers with JSON).

Types and parameter names are matched against fixed tables; nothing a client sends becomes an
atom.

# `parse`

```elixir
@spec parse(String.t() | nil) :: [PgRest.MediaType.t()]
```

The media types of an `Accept` header value, by descending `q`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
