Skip to main content

parse_link_next

Function parse_link_next 

Source
pub fn parse_link_next(value: &str) -> Option<Url>
Available on crate feature transport only.
Expand description

Extracts the rel="next" URL from a Link header value.

Handles a header carrying several links, and tolerates the unquoted rel=next form that some implementations emit.

use ocpi_kit::transport::parse_link_next;

let header = r#"<https://e.com/cdrs/?offset=150&limit=50>; rel="next""#;
assert_eq!(parse_link_next(header).unwrap().as_str(), "https://e.com/cdrs/?offset=150&limit=50");
assert!(parse_link_next(r#"<https://e.com/a>; rel="prev""#).is_none());