Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(profiles): use next_back instead of last on split iterator

Steven Enamakel6eeb4932704c
diff --git a/crates/openhuman-core/src/profiles/gateway_proptest_tests.rs b/crates/openhuman-core/src/profiles/gateway_proptest_tests.rs
index 1d178bc42c..fa06f74705 100644
--- a/crates/openhuman-core/src/profiles/gateway_proptest_tests.rs
+++ b/crates/openhuman-core/src/profiles/gateway_proptest_tests.rs
@@ -164,7 +164,7 @@ proptest! {
#[test]
fn verify_only_accepts_a_full_tag_for_this_user(user in user_header(), header in any::<String>()) {
if verify(SECRET, &user, &header, NOW).is_ok() {
- let ts = header.split(',').filter_map(|p| p.trim().strip_prefix("t=")).last();
+ let ts = header.split(',').filter_map(|p| p.trim().strip_prefix("t=")).next_back();
let ts: u64 = ts.and_then(|t| t.parse().ok()).expect("accepted without a t");
prop_assert!(ts.abs_diff(NOW) <= SIGNATURE_WINDOW_SECS);
prop_assert!(header.to_ascii_lowercase().contains(sign(SECRET, &user, ts).split_once("v1=").unwrap().1));