Skip to content

Commit

Permalink
Patch release. (#97)
Browse files Browse the repository at this point in the history
* Patch release.

* Add the tests in tokio.
  • Loading branch information
Narsil authored Feb 26, 2025
1 parent 17a5969 commit 357331d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hf-hub"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
homepage = "https://github.com/huggingface/hf-hub"
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions src/api/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ mod tests {
let headers = api.client.headers;
assert_eq!(
headers.get(USER_AGENT),
Some(&"unknown/None; hf-hub/0.4.1; rust/unknown".to_string())
Some(&"unknown/None; hf-hub/0.4.2; rust/unknown".to_string())
);
}

Expand All @@ -1279,7 +1279,7 @@ mod tests {
let headers = api.client.headers;
assert_eq!(
headers.get(USER_AGENT),
Some(&"unknown/None; hf-hub/0.4.1; rust/unknown; origin/custom".to_string())
Some(&"unknown/None; hf-hub/0.4.2; rust/unknown; origin/custom".to_string())
);
}

Expand Down
29 changes: 29 additions & 0 deletions src/api/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,35 @@ mod tests {
);
}

#[test]
fn headers_default() {
let headers = ApiBuilder::new().build_headers().unwrap();
assert_eq!(
headers.get(USER_AGENT),
Some(
&"unknown/None; hf-hub/0.4.2; rust/unknown"
.try_into()
.unwrap()
)
);
}

#[test]
fn headers_custom() {
let headers = ApiBuilder::new()
.with_user_agent("origin", "custom")
.build_headers()
.unwrap();
assert_eq!(
headers.get(USER_AGENT),
Some(
&"unknown/None; hf-hub/0.4.2; rust/unknown; origin/custom"
.try_into()
.unwrap()
)
);
}

// #[tokio::test]
// async fn real() {
// let api = Api::new().unwrap();
Expand Down

0 comments on commit 357331d

Please sign in to comment.