pub fn negotiate<'a, S: AsRef<str>>(
accept: &str,
available: &'a [S],
) -> Option<&'a str>Expand description
Pick the best media type the server can produce, given the client’s
Accept header value and the list of types the server supports.
accept is the raw header value (e.g. "application/json,text/html;q=0.9,*/*;q=0.5").
available is the ordered list of types the server can serve.
Matching rules:
- Exact match wins over wildcard match
- Higher q-value wins over lower
- Server’s
availableorder breaks ties at equal q - Returns
Noneonly whenavailableis empty or no client preference matches (a*/*client preference will always match the first available type)