fn get_next_page()

in issue-bot/src/github.rs [109:124]


fn get_next_page(link_header: Option<HeaderValue>) -> Result<Option<String>, GithubApiError> {
    let header = match link_header {
        Some(h) => h.to_str()?.to_owned(),
        None => return Ok(None),
    };

    Ok(header
        .split(", ")
        .find(|part| part.contains("rel=\"next\""))
        .map(|part| {
            part.chars()
                .skip(1)
                .take_while(|c| *c != '>')
                .collect::<String>()
        }))
}