RFC 8288 parser
RFC 8288 specifies the convention for parsing the Link header.
use nom_rfc8288::complete::{link, LinkData, LinkParam};
let link_data = r#"<https://example.com>; rel="origin"; csv="one,two""#;
let parsed = link(link_data).unwrap();
assert_eq!(
parsed,
vec![
Some(
LinkData {
url: "https://example.com",
params: vec![
LinkParam {
key: "rel",
val: Some("origin".to_owned()),
},
LinkParam {
key: "csv",
val: Some("one,two".to_owned()),
}
],
}
),
]
);
See the pre-commit
quick start guide for how to setup pre-commit
.