mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
improvement: replace reqwest with attohttpc (#999)
This commit is contained in:
+4
-5
@@ -32,13 +32,12 @@ pub fn create() {
|
||||
|
||||
#[cfg(feature = "http")]
|
||||
fn shorten_link(link: &str) -> Option<String> {
|
||||
reqwest::blocking::Client::new()
|
||||
.post(&format!("{}{}", GIT_IO_BASE_URL, "create"))
|
||||
attohttpc::post(&format!("{}{}", GIT_IO_BASE_URL, "create"))
|
||||
.form(&[("url", link)])
|
||||
.send()
|
||||
.and_then(|response| response.text())
|
||||
.map(|slug| format!("{}{}", GIT_IO_BASE_URL, slug))
|
||||
.ok()
|
||||
.and_then(|r| r.send().ok())
|
||||
.and_then(|r| r.text().ok())
|
||||
.map(|slug| format!("{}{}", GIT_IO_BASE_URL, slug))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "http"))]
|
||||
|
||||
Reference in New Issue
Block a user