improvement: replace reqwest with attohttpc (#999)

This commit is contained in:
David Knaack
2020-03-15 02:07:34 +01:00
committed by GitHub
parent 8479e72b3e
commit fef8cc8bbd
4 changed files with 92 additions and 667 deletions
+4 -5
View File
@@ -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"))]