Add function to set hydrus user agent to hydrus

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/3/head
trivernis 3 years ago
parent d84eceb840
commit d48a5da471
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,6 +1,6 @@
[package] [package]
name = "hydrus-api" name = "hydrus-api"
version = "0.3.1" version = "0.3.2"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"

@ -121,4 +121,9 @@ impl Hydrus {
pages_response.pages, pages_response.pages,
)) ))
} }
/// Sets the user agent hydrus uses for http requests
pub async fn set_user_agent<S: ToString>(&self, user_agent: S) -> Result<()> {
self.client.set_user_agent(user_agent).await
}
} }

@ -60,3 +60,12 @@ async fn it_adds_tags() {
.await .await
.unwrap(); .unwrap();
} }
#[tokio::test]
async fn it_sets_the_user_agent() {
let hydrus = common::get_hydrus();
hydrus
.set_user_agent("Mozilla/5.0 (compatible; Hydrus Client)")
.await
.unwrap();
}

Loading…
Cancel
Save