diff --git a/Cargo.toml b/Cargo.toml index 142146e..afd8a4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydrus-api" -version = "0.3.1" +version = "0.3.2" authors = ["trivernis "] edition = "2018" license = "Apache-2.0" diff --git a/src/wrapper/hydrus.rs b/src/wrapper/hydrus.rs index cc79b8c..da49c01 100644 --- a/src/wrapper/hydrus.rs +++ b/src/wrapper/hydrus.rs @@ -121,4 +121,9 @@ impl Hydrus { pages_response.pages, )) } + + /// Sets the user agent hydrus uses for http requests + pub async fn set_user_agent(&self, user_agent: S) -> Result<()> { + self.client.set_user_agent(user_agent).await + } } diff --git a/tests/wrapper/test_hydrus.rs b/tests/wrapper/test_hydrus.rs index 794c347..605eeb1 100644 --- a/tests/wrapper/test_hydrus.rs +++ b/tests/wrapper/test_hydrus.rs @@ -60,3 +60,12 @@ async fn it_adds_tags() { .await .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(); +}