pub fn media_type(accept: Option<&str>) -> Result<&'static str>Expand description
Picks the media type to answer an Accept header with.
A missing or empty header is treated as */*, per RFC 9110. Candidates are
scored by quality value; ties go to this crate’s own preference order.
SSE is the only implemented transport, with or without the protobuf
feature, so the binary media type is never the answer.
Returns Error::UnsupportedMediaType when the header excludes everything
this build can emit — the case that deserves a 406.
assert_eq!(media_type(None).unwrap(), SSE_MEDIA_TYPE);
assert_eq!(media_type(Some("text/event-stream")).unwrap(), SSE_MEDIA_TYPE);
assert!(media_type(Some("application/xml")).is_err());