Function parse_payload_accept
pub fn parse_payload_accept(value: &[u8]) -> Result<Vec<&str>, CratestackError>Expand description
Parse a received PAYLOAD_ACCEPT_HEADER value, strictly: the sender’s
order is kept, entries are separated by exactly ", ", and a repeated
entry is refused so the list has one spelling.
use cratestack_core::parse_payload_accept;
assert_eq!(
parse_payload_accept(b"application/json, application/cbor").unwrap(),
["application/json", "application/cbor"]
);
assert!(parse_payload_accept(b"application/json,application/cbor").is_err());
assert!(parse_payload_accept(b"application/json;q=0.5").is_err());