mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-17 17:43:37 -05:00
V3
Many many many changes, honestly just read the release notes
This commit is contained in:
13
src/utils/link.rs
Normal file
13
src/utils/link.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use http_link::parse_link_header;
|
||||
use reqwest::Url;
|
||||
|
||||
use crate::error;
|
||||
|
||||
pub fn parse_link(link: &str, base: &str) -> String {
|
||||
match parse_link_header(link, &Url::from_str(base).unwrap()) {
|
||||
Ok(l) => l[0].target.to_string(),
|
||||
Err(e) => error!("Failed to parse link! {}", e),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user