pub fn negotiate(accept: Option<&str>) -> Result<SseFormatter>Expand description
Picks the response encoding for an Accept header.
A missing or empty header means */* and yields SSE. Anything that excludes
every media type this build can emit is Error::NotAcceptable, which
renders as a 406.
assert!(negotiate(None).is_ok());
assert!(negotiate(Some("text/event-stream")).is_ok());
assert!(negotiate(Some("text/*;q=0.4, application/json")).is_ok());
assert!(negotiate(Some("application/xml")).is_err());
assert!(negotiate(Some("*/*;q=0")).is_err());